directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r400123 - /directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java
Date Fri, 05 May 2006 17:55:17 GMT
Author: jim
Date: Fri May  5 10:55:15 2006
New Revision: 400123

URL: http://svn.apache.org/viewcvs?rev=400123&view=rev
Log:
Adding blocked endpoints should always be synchronized. So
centralize where this is done.

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java
URL: http://svn.apache.org/viewcvs/directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java?rev=400123&r1=400122&r2=400123&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java (original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/filter/BlacklistFilter.java Fri
May  5 10:55:15 2006
@@ -57,11 +57,7 @@
         for( int i = 0; i < addresses.length; i++ )
         {
             InetAddress addr = addresses[ i ];
-            if( addr == null )
-            {
-                throw new NullPointerException( "addresses[" + i + ']' );
-            }
-            blacklist.add( addr );
+            block (addr, "addresses[" + i + ']' );
         }
     }
     
@@ -97,11 +93,19 @@
     /**
      * Blocks the specified endpoint.
      */
-    public synchronized void block( InetAddress address )
+    public synchronized void block( InetAddress address , String error_string )
     {
         if( address == null )
-            throw new NullPointerException( "address" );
+            throw new NullPointerException( error_string );
         blacklist.add( address );
+    }
+
+    /**
+     * Blocks the specified endpoint.
+     */
+    public synchronized void block( InetAddress address )
+    {
+        block( address, "address" );
     }
 
     /**



Mime
View raw message