< prev index next >

src/java.sql/share/classes/java/sql/DriverManager.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad


 605                      * will be thrown at runtime by the VM trying to locate
 606                      * and load the service.
 607                      *
 608                      * Adding a try catch block to catch those runtime errors
 609                      * if driver not available in classpath but it's
 610                      * packaged as service and that service is there in classpath.
 611                      */
 612                     try {
 613                         while (driversIterator.hasNext()) {
 614                             driversIterator.next();
 615                         }
 616                     } catch (Throwable t) {
 617                         // Do nothing
 618                     }
 619                     return null;
 620                 }
 621             });
 622 
 623             println("DriverManager.initialize: jdbc.drivers = " + drivers);
 624 
 625             if (drivers != null && !drivers.equals("")) {
 626                 String[] driversList = drivers.split(":");
 627                 println("number of Drivers:" + driversList.length);
 628                 for (String aDriver : driversList) {
 629                     try {
 630                         println("DriverManager.Initialize: loading " + aDriver);
 631                         Class.forName(aDriver, true,
 632                                 ClassLoader.getSystemClassLoader());
 633                     } catch (Exception ex) {
 634                         println("DriverManager.Initialize: load failed: " + ex);
 635                     }
 636                 }
 637             }
 638 
 639             driversInitialized = true;
 640             println("JDBC DriverManager initialized");
 641         }
 642     }
 643 
 644 
 645     //  Worker method called by the public getConnection() methods.




 605                      * will be thrown at runtime by the VM trying to locate
 606                      * and load the service.
 607                      *
 608                      * Adding a try catch block to catch those runtime errors
 609                      * if driver not available in classpath but it's
 610                      * packaged as service and that service is there in classpath.
 611                      */
 612                     try {
 613                         while (driversIterator.hasNext()) {
 614                             driversIterator.next();
 615                         }
 616                     } catch (Throwable t) {
 617                         // Do nothing
 618                     }
 619                     return null;
 620                 }
 621             });
 622 
 623             println("DriverManager.initialize: jdbc.drivers = " + drivers);
 624 
 625             if (drivers != null && !drivers.isEmpty()) {
 626                 String[] driversList = drivers.split(":");
 627                 println("number of Drivers:" + driversList.length);
 628                 for (String aDriver : driversList) {
 629                     try {
 630                         println("DriverManager.Initialize: loading " + aDriver);
 631                         Class.forName(aDriver, true,
 632                                 ClassLoader.getSystemClassLoader());
 633                     } catch (Exception ex) {
 634                         println("DriverManager.Initialize: load failed: " + ex);
 635                     }
 636                 }
 637             }
 638 
 639             driversInitialized = true;
 640             println("JDBC DriverManager initialized");
 641         }
 642     }
 643 
 644 
 645     //  Worker method called by the public getConnection() methods.


< prev index next >