From cf307db31da901ac65ed94e884cab199d8048962 Mon Sep 17 00:00:00 2001 From: Chris Eager Date: Wed, 17 Apr 2024 17:45:56 -0500 Subject: [PATCH] =?UTF-8?q?Update=20JsonMappingExceptionMapper=20=E2=80=9C?= =?UTF-8?q?Early=20EOF=E2=80=9D=20logic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../textsecuregcm/mappers/JsonMappingExceptionMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/mappers/JsonMappingExceptionMapper.java b/service/src/main/java/org/whispersystems/textsecuregcm/mappers/JsonMappingExceptionMapper.java index 59b9d4a6d..25c5c5f9b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/mappers/JsonMappingExceptionMapper.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/mappers/JsonMappingExceptionMapper.java @@ -3,15 +3,15 @@ package org.whispersystems.textsecuregcm.mappers; import com.fasterxml.jackson.databind.JsonMappingException; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; -import java.util.concurrent.TimeoutException; public class JsonMappingExceptionMapper implements ExceptionMapper { @Override public Response toResponse(final JsonMappingException exception) { - if (exception.getCause() instanceof TimeoutException) { + if (exception.getCause() instanceof java.util.concurrent.TimeoutException) { return Response.status(Response.Status.REQUEST_TIMEOUT).build(); } - if ("Early EOF".equals(exception.getMessage())) { + if (exception.getCause() instanceof org.eclipse.jetty.io.EofException + || exception.getMessage() != null && exception.getMessage().startsWith("Early EOF")) { // Some sort of timeout or broken connection return Response.status(Response.Status.BAD_REQUEST).build(); }