Author: markt Date: Tue May 31 18:50:12 2016 New Revision: 1746319 URL: http://svn.apache.org/viewvc?rev=1746319&view=rev Log: Refactor
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1746319&r1=1746318&r2=1746319&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Tue May 31 18:50:12 2016 @@ -839,6 +839,12 @@ public class Nio2Endpoint extends Abstra public IOException getError() { return error; } public void setError(IOException error) { this.error = error; } + public void checkError() throws IOException { + IOException ioe = error; + if (ioe != null) { + throw ioe; + } + } @Override @@ -868,9 +874,7 @@ public class Nio2Endpoint extends Abstra @Override public int read(boolean block, byte[] b, int off, int len) throws IOException { - if (getError() != null) { - throw getError(); - } + checkError(); if (log.isDebugEnabled()) { log.debug("Socket: [" + this + "], block: [" + block + "], length: [" + len + "]"); @@ -1257,9 +1261,7 @@ public class Nio2Endpoint extends Abstra @Override protected void flushBlocking() throws IOException { - if (getError() != null) { - throw getError(); - } + checkError(); // Before doing a blocking flush, make sure that any pending non // blocking write has completed. @@ -1278,10 +1280,7 @@ public class Nio2Endpoint extends Abstra @Override protected boolean flushNonBlocking() throws IOException { - if (getError() != null) { - throw getError(); - } - + checkError(); return flushNonBlocking(false); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org