Pārlūkot izejas kodu

Modified the setAttribute() method to remove the attribute
if the value is null instead of throwin an NPE.


git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7485 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

PSp..om 14 gadi atpakaļ
vecāks
revīzija
e6c9cbac12

+ 2 - 1
engine/src/networking/com/jme3/network/HostedConnection.java

@@ -68,7 +68,8 @@ public interface HostedConnection extends MessageConnection
     public void close( String reason );
     public void close( String reason );
     
     
     /**
     /**
-     *  Sets a session attribute specific to this connection.
+     *  Sets a session attribute specific to this connection.  If the value
+     *  is set to null then the attribute is removed.
      *
      *
      *  @return The previous session value for this key or null
      *  @return The previous session value for this key or null
      *          if there was no previous value.
      *          if there was no previous value.

+ 2 - 0
engine/src/networking/com/jme3/network/base/DefaultServer.java

@@ -443,6 +443,8 @@ public class DefaultServer implements Server
         
         
         public Object setAttribute( String name, Object value )
         public Object setAttribute( String name, Object value )
         {
         {
+            if( value == null )
+                return sessionData.remove(name);
             return sessionData.put(name, value);
             return sessionData.put(name, value);
         }
         }