From: pero Date: Fri, 7 Nov 2008 21:40:37 +0000 (+0000) Subject: Fix NPE to use Http11NioProtocol handler with default parameters! X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=db40cf1e98c0e3c13f6a2bcf3c3733e1f04d5b7f;p=tomcat7.0 Fix NPE to use Http11NioProtocol handler with default parameters! # example: Used at MAC OS X with "-Djava.net.preferIPv4Stack=true" I am not sure that default returns are correct! git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@712278 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index a53f93f9e..57f61ddd7 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -735,7 +735,12 @@ public class NioEndpoint { return; serverSock = ServerSocketChannel.open(); - serverSock.socket().setPerformancePreferences(socketProperties.getPerformanceConnectionTime(), + int performanceConnectionTime = socketProperties.getPerformanceConnectionTime(); + int performanceLatency= socketProperties.getPerformanceLatency(); + int performanceBandwidth = socketProperties.getPerformanceBandwidth(); + if (performanceConnectionTime != -1 && performanceLatency != -1 && + performanceBandwidth != -1) + serverSock.socket().setPerformancePreferences(socketProperties.getPerformanceConnectionTime(), socketProperties.getPerformanceLatency(), socketProperties.getPerformanceBandwidth()); InetSocketAddress addr = (address!=null?new InetSocketAddress(address,port):new InetSocketAddress(port)); diff --git a/java/org/apache/tomcat/util/net/SocketProperties.java b/java/org/apache/tomcat/util/net/SocketProperties.java index 4401deeef..1a39718a2 100644 --- a/java/org/apache/tomcat/util/net/SocketProperties.java +++ b/java/org/apache/tomcat/util/net/SocketProperties.java @@ -210,55 +210,82 @@ public class SocketProperties { } public boolean getOoBInline() { - return ooBInline.booleanValue(); + if(ooBInline != null) + return ooBInline.booleanValue(); + return false; } public int getPerformanceBandwidth() { - return performanceBandwidth.intValue(); + if(performanceBandwidth != null) + return performanceBandwidth.intValue(); + return -1; } public int getPerformanceConnectionTime() { - return performanceConnectionTime.intValue(); + if(performanceConnectionTime!= null) + return performanceConnectionTime.intValue(); + return -1; + } public int getPerformanceLatency() { - return performanceLatency.intValue(); + if(performanceLatency != null) + return performanceLatency.intValue(); + return -1 ; } public int getRxBufSize() { - return rxBufSize.intValue(); + if(rxBufSize != null) + return rxBufSize.intValue(); + return -1; } public boolean getSoKeepAlive() { - return soKeepAlive.booleanValue(); + if(soKeepAlive != null) + return soKeepAlive.booleanValue(); + return false; } public boolean getSoLingerOn() { - return soLingerOn.booleanValue(); + if(soLingerOn != null) + return soLingerOn.booleanValue(); + return false; } public int getSoLingerTime() { - return soLingerTime.intValue(); + if(soLingerTime != null) + return soLingerTime.intValue(); + return -1; } public boolean getSoReuseAddress() { - return soReuseAddress.booleanValue(); + if(soReuseAddress != null) + return soReuseAddress.booleanValue(); + return false; } public int getSoTimeout() { - return soTimeout.intValue(); + if(soTimeout != null) + return soTimeout.intValue(); + return -1; } public int getSoTrafficClass() { - return soTrafficClass.intValue(); + if(soTrafficClass != null) + return soTrafficClass.intValue(); + return -1; } public boolean getTcpNoDelay() { - return tcpNoDelay.booleanValue(); + if(tcpNoDelay != null) + return tcpNoDelay.booleanValue(); + return false; } public int getTxBufSize() { - return txBufSize.intValue(); + if(txBufSize != null) + return txBufSize.intValue(); + return -1; } public int getBufferPool() {