public static boolean isSocketException ( Throwable x ) { // JENKINS-10524 if ( x == null ) { return false ; } if ( x instanceof SocketException ) { return true ; } if ( String . valueOf ( x . getMessage ( ) ) . equals ( "Broken pipe" ) ) { // TBD I18N return true ; } // JENKINS-20074: various things that Jetty and other components could throw if ( x instanceof EOFException ) { return true ; } if ( x instanceof IOException && "Closed" . equals ( x . getMessage ( ) ) ) { // org.eclipse.jetty.server.HttpOutput.print return true ; } if ( x instanceof IOException && "finished" . equals ( x . getMessage ( ) ) ) { //com.jcraft.jzlib.DeflaterOutputStream.write return true ; } return isSocketException ( x . getCause ( ) ) ; }
Used to detect exceptions thrown when writing content that seem to be due merely to a closed socket .