correct a null pointer exception check before it gets caught and logged as an error
This commit is contained in:
@ -350,12 +350,12 @@ public class SAMv3Handler extends SAMv1Handler
|
|||||||
_log.debug("Stop request found");
|
_log.debug("Stop request found");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
String line = DataHelper.readLine(in) ;
|
||||||
msg = DataHelper.readLine(in).trim();
|
if (line==null) {
|
||||||
if (msg == null) {
|
_log.debug("Connection closed by client (line read : null)");
|
||||||
_log.debug("Connection closed by client");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
msg = line.trim();
|
||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG)) {
|
if (_log.shouldLog(Log.DEBUG)) {
|
||||||
_log.debug("New message received: [" + msg + "]");
|
_log.debug("New message received: [" + msg + "]");
|
||||||
|
@ -264,12 +264,12 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
while (session.socketServer!=null) {
|
while (session.getSocketServer()!=null) {
|
||||||
|
|
||||||
// wait and accept a connection from I2P side
|
// wait and accept a connection from I2P side
|
||||||
I2PSocket i2ps = null ;
|
I2PSocket i2ps = null ;
|
||||||
try {
|
try {
|
||||||
i2ps = session.socketServer.accept();
|
i2ps = session.getSocketServer().accept();
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
|
|
||||||
if (i2ps==null) {
|
if (i2ps==null) {
|
||||||
@ -361,8 +361,14 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public I2PServerSocket getSocketServer()
|
||||||
|
{
|
||||||
|
synchronized ( this.socketServerLock ) {
|
||||||
|
return this.socketServer ;
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
* stop Forwarding Incoming connection coming from I2P
|
||||||
* @param props
|
* @param props
|
||||||
* @throws SAMException
|
* @throws SAMException
|
||||||
* @throws InterruptedIOException
|
* @throws InterruptedIOException
|
||||||
@ -382,6 +388,7 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
}
|
}
|
||||||
server = this.socketServer ;
|
server = this.socketServer ;
|
||||||
this.socketServer = null ;
|
this.socketServer = null ;
|
||||||
|
_log.debug("nulling socketServer in stopForwardingIncoming. Object " + this );
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
server.close();
|
server.close();
|
||||||
@ -400,5 +407,4 @@ public class SAMv3StreamSession extends SAMStreamSession implements SAMv3Handle
|
|||||||
{
|
{
|
||||||
throw new DataFormatException(null);
|
throw new DataFormatException(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,8 +73,8 @@ public class MessageHandler implements I2PSessionListener {
|
|||||||
* @param session that has been terminated
|
* @param session that has been terminated
|
||||||
*/
|
*/
|
||||||
public void disconnected(I2PSession session) {
|
public void disconnected(I2PSession session) {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.error("I2PSession disconnected");
|
_log.warn("I2PSession disconnected");
|
||||||
_manager.disconnectAllHard();
|
_manager.disconnectAllHard();
|
||||||
|
|
||||||
List listeners = null;
|
List listeners = null;
|
||||||
|
Reference in New Issue
Block a user