From: Dave B. <bla...@us...> - 2011-03-23 15:48:10
|
Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/http In directory vz-cvs-3.sog:/tmp/cvs-serv3917/src/org/sblim/cimclient/internal/http Modified Files: Tag: Experimental HttpClient.java Log Message: 3235440 - NullPointerException when socket factory returns null Index: HttpClient.java =================================================================== RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/http/HttpClient.java,v retrieving revision 1.12.2.23 retrieving revision 1.12.2.24 diff -u -d -r1.12.2.23 -r1.12.2.24 --- HttpClient.java 28 Feb 2011 17:01:08 -0000 1.12.2.23 +++ HttpClient.java 23 Mar 2011 15:48:08 -0000 1.12.2.24 @@ -57,6 +57,7 @@ * 3022554 2010-06-30 blaschke-oss Flushing socket ignores skip() return code * 3046073 2010-09-07 blaschke-oss Performance hit due to socket conn. creation with timeout * 3195069 2011-02-28 blaschke-oss Need support to disable SSL Handshake + * 3235440 2011-03-22 blaschke-oss NullPointerException when socket factory returns null */ package org.sblim.cimclient.internal.http; @@ -989,11 +990,16 @@ logger.trace(Level.FINER, "Creating new http for url " + this.iUrl.toString()); if (socketConnectWithTimeout) { this.iSocket = factory.createSocket(); - this.iSocket.connect( - new InetSocketAddress(this.iUrl.getHost(), this.iUrl.getPort()), timeout); + if (this.iSocket != null) this.iSocket.connect(new InetSocketAddress(this.iUrl + .getHost(), this.iUrl.getPort()), timeout); } else { this.iSocket = factory.createSocket(this.iUrl.getHost(), this.iUrl.getPort()); } + if (this.iSocket == null) { + logger.trace(Level.WARNING, "Socket factory " + factory.getClass().getName() + + " returned null socket"); + throw new IOException("Socket factory did not create socket"); + } this.iSocket.setTcpNoDelay(true); this.iSocket.setKeepAlive(true); |