You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2010/01/14 08:11:26 UTC
svn commit: r899085 -
/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java
Author: elecharny
Date: Thu Jan 14 07:11:25 2010
New Revision: 899085
URL: http://svn.apache.org/viewvc?rev=899085&view=rev
Log:
Fix the potential NPE when updating the receivedBufferSize when the config is not associated yet with a service (DIRMINA-746)
Modified:
mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java
Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java?rev=899085&r1=899084&r2=899085&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/DefaultSocketSessionConfig.java Thu Jan 14 07:11:25 2010
@@ -58,11 +58,14 @@
public void init(IoService parent) {
this.parent = parent;
+
if (parent instanceof SocketAcceptor) {
defaultReuseAddress = true;
+ defaultReceiveBufferSize = receiveBufferSize;
} else {
defaultReuseAddress = DEFAULT_REUSE_ADDRESS;
}
+
reuseAddress = defaultReuseAddress;
}
@@ -89,7 +92,7 @@
// not bound yet to avoid a unnecessary system call
// when the acceptor is activated and new sessions are
// created.
- if (!parent.isActive() && parent instanceof SocketAcceptor) {
+ if ((parent != null) && !parent.isActive() && parent instanceof SocketAcceptor) {
defaultReceiveBufferSize = receiveBufferSize;
}
}