diff --git a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java index 2cf7da282..13c195198 100644 --- a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java +++ b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.SocketException; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.util.zip.GZIPOutputStream; @@ -81,6 +82,13 @@ *
* *+ * Version 1.2 + *
* Thread safety: Technically this class is NOT thread safe since it has mutable states, but the intended * usage of the mutators is for IoC injection and thus we expect for these values not to be changed after * initialization. Thus this class can be considered as thread-safe conditional in an IoC injection usage of @@ -88,7 +96,7 @@ *
* * @author AleaActaEst, TCSDEVELOPER, duxiaoyang - * @version 1.1 + * @version 1.2 */ @SuppressWarnings("serial") public class CustomFormatAJAXResult implements Result { @@ -300,11 +308,13 @@ private static void writeDataAndClose(InputStream in, OutputStream out) throws I } // flush output stream out.flush(); + } catch (SocketException e) { + // The client side has aborted or closed connection } finally { // close the input stream closeStream(in); // close the output stream - out.close(); + closeStream(out); } }