commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet DistributeBridgeMDO.java
Date Mon, 08 Jul 2002 14:59:31 GMT
jstrachan    2002/07/08 07:59:31

  Modified:    messenger/src/java/org/apache/commons/messagelet
                        DistributeBridgeMDO.java
  Log:
  patched randomizing destination logic so that we don't get an out of bounds exception! :-)
  
  Revision  Changes    Path
  1.2       +4 -1      jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/DistributeBridgeMDO.java
  
  Index: DistributeBridgeMDO.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/DistributeBridgeMDO.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DistributeBridgeMDO.java	8 Jul 2002 14:37:36 -0000	1.1
  +++ DistributeBridgeMDO.java	8 Jul 2002 14:59:31 -0000	1.2
  @@ -77,7 +77,10 @@
               throw new JMSException( "No output destinations are available" );
           }
           
  -        int index = Math.round( (float) (Math.random() * size ) );
  +        int index = (int) Math.round( Math.random() * size );
  +        if ( index == size ) {
  +            index = size -1;
  +        }
           return (Destination) outputDestinations.get(index);        
       }
       
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message