commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources InstanceKeyObjectFactory.java
Date Sat, 28 Feb 2004 21:51:59 GMT
dirkv       2004/02/28 13:51:59

  Modified:    dbcp/src/java/org/apache/commons/dbcp/datasources
                        InstanceKeyObjectFactory.java
  Log:
  Bugzilla Bug 24082: NumberFormatException: For input string: "myDB" in InstanceKeyDataSourceFactory
  - patch by Brett Porter
  
  Revision  Changes    Path
  1.9       +7 -2      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/InstanceKeyObjectFactory.java
  
  Index: InstanceKeyObjectFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/InstanceKeyObjectFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- InstanceKeyObjectFactory.java	28 Feb 2004 12:18:17 -0000	1.8
  +++ InstanceKeyObjectFactory.java	28 Feb 2004 21:51:59 -0000	1.9
  @@ -50,7 +50,12 @@
               Object obj = i.next();
               if (obj instanceof String) 
               {
  -                max = Math.max(max, Integer.parseInt((String)obj));
  +                try {
  +                    max = Math.max(max, Integer.valueOf((String)obj).intValue());
  +                }
  +                catch (NumberFormatException e) {
  +                    // no sweat, ignore those keys
  +                }
               }
           }
           String instanceKey = String.valueOf(max + 1);
  
  
  

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


Mime
View raw message