|
From: <lk...@us...> - 2004-09-21 12:54:54
|
Update of /cvsroot/openorb/NotificationService/src/main/org/openorb/notify/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15350/src/main/org/openorb/notify/impl Modified Files: EventChannelImpl.java Log Message: Fixed ArrayIndexOutOfBoundsException in EventChannelImpl.reportConsumerAdminDestruction (bug #901213) Also use Arrays.equals() instead of building Strings to compare two byte arrays for equality Index: EventChannelImpl.java =================================================================== RCS file: /cvsroot/openorb/NotificationService/src/main/org/openorb/notify/impl/EventChannelImpl.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- EventChannelImpl.java 10 Feb 2004 21:53:31 -0000 1.22 +++ EventChannelImpl.java 21 Sep 2004 12:54:44 -0000 1.23 @@ -8,6 +8,10 @@ package org.openorb.notify.impl; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; + import org.omg.CosNotification.EventType; import org.omg.CosNotifyChannelAdmin.ConsumerAdminHelper; import org.omg.CosNotifyChannelAdmin.EventChannelFactoryHelper; @@ -898,14 +902,12 @@ { return; } - ConnectionInfo[] new_consumers = - new ConnectionInfo[ consumers.length - 1 ]; - int j = 0; + List newConsumersList = new ArrayList( consumers.length - 1 ); for ( int i = 0; i < consumers.length; i++ ) { - if ( new String( consumers[ i ].pid ).equals( new String( adminPid ) ) ) + if ( Arrays.equals( consumers[ i ].pid, adminPid ) ) { try { @@ -930,9 +932,14 @@ continue; } - new_consumers[ j++ ] = consumers[ i ]; + newConsumersList.add( consumers[ i ] ); } + ConnectionInfo[] new_consumers = + new ConnectionInfo[ newConsumersList.size() ]; + + newConsumersList.toArray( new_consumers ); + m_pssEventChannel.consumer_admins( new_consumers ); } @@ -954,7 +961,7 @@ int j = 0; for ( int i = 0; i < suppliers.length; i++ ) { - if ( new String( suppliers[ i ].pid ).equals( new String( adminPid ) ) ) + if ( Arrays.equals( suppliers[ i ].pid, adminPid ) ) { continue; } |