Browse Source

ignore ClientAbortException

Shinsuke Sugaya 9 years ago
parent
commit
4b9b699b7f
1 changed files with 9 additions and 5 deletions
  1. 9 5
      src/main/java/org/codelibs/fess/api/es/EsApiManager.java

+ 9 - 5
src/main/java/org/codelibs/fess/api/es/EsApiManager.java

@@ -116,11 +116,15 @@ public class EsApiManager extends BaseApiManager {
                 CopyUtil.copy(in, out);
             } catch (final ClientAbortException e) {
                 logger.debug("Client aborts this request.", e);
-            } catch (final IOException e) {
-                try (InputStream err = con.getErrorStream()) {
-                    logger.error(new String(InputStreamUtil.getBytes(err), Constants.CHARSET_UTF_8));
-                } catch (final IOException e1) {}
-                throw new WebApiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
+            } catch (final Exception e) {
+                if (e.getCause() instanceof ClientAbortException) {
+                    logger.debug("Client aborts this request.", e);
+                } else {
+                    try (InputStream err = con.getErrorStream()) {
+                        logger.error(new String(InputStreamUtil.getBytes(err), Constants.CHARSET_UTF_8));
+                    } catch (final IOException e1) {}
+                    throw new WebApiException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e);
+                }
             }
         });
     }