xml-commons-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ne...@apache.org
Subject cvs commit: xml-commons/java/external/src/javax/xml/transform FactoryFinder.java
Date Fri, 17 May 2002 16:13:15 GMT
neilg       02/05/17 09:13:15

  Modified:    java/external/src/org/xml/sax/helpers Tag: RIVERCOURT1
                        NewInstance.java
               java/external/src/javax/xml/parsers Tag: RIVERCOURT1
                        FactoryFinder.java
               java/external/src/javax/xml/transform Tag: RIVERCOURT1
                        FactoryFinder.java
  Log:
  Enable applications who do not wish to set the context classLoader (that of the current
thread) to still find a parser/transformer implementation.  If the class loader of the current
thread is null or produces a ClassNotFoundException, this allows the "current" classloader
(the one that loaded the factory) to be used as a fallback.  Keeps this code in sync with
Xerces
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +8 -7      xml-commons/java/external/src/org/xml/sax/helpers/NewInstance.java
  
  Index: NewInstance.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/org/xml/sax/helpers/NewInstance.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- NewInstance.java	10 May 2002 20:42:39 -0000	1.1.2.1
  +++ NewInstance.java	17 May 2002 16:13:15 -0000	1.1.2.2
  @@ -3,7 +3,7 @@
   // Written by Edwin Goei, edwingo@apache.org
   // and by David Brownell, dbrownell@users.sourceforge.net
   // NO WARRANTY!  This class is in the Public Domain.
  -// $Id: NewInstance.java,v 1.1.2.1 2002/05/10 20:42:39 sboag Exp $
  +// $Id: NewInstance.java,v 1.1.2.2 2002/05/17 16:13:15 neilg Exp $
   
   package org.xml.sax.helpers;
   
  @@ -42,13 +42,14 @@
           throws ClassNotFoundException, IllegalAccessException,
               InstantiationException
       {
  -        Class driverClass;
  -        if (classLoader == null) {
  -            driverClass = Class.forName(className);
  -        } else {
  -            driverClass = classLoader.loadClass(className);
  +        if (classLoader != null) {
  +            try {
  +                  return classLoader.loadClass(className).newInstance ();
  +            } catch (ClassNotFoundException x) {
  +                  // try again
  +            }
           }
  -        return driverClass.newInstance();
  +        return Class.forName(className).newInstance();
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.4.1   +7 -6      xml-commons/java/external/src/javax/xml/parsers/FactoryFinder.java
  
  Index: FactoryFinder.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/parsers/FactoryFinder.java,v
  retrieving revision 1.7
  retrieving revision 1.7.4.1
  diff -u -r1.7 -r1.7.4.1
  --- FactoryFinder.java	26 Oct 2001 00:23:31 -0000	1.7
  +++ FactoryFinder.java	17 May 2002 16:13:15 -0000	1.7.4.1
  @@ -125,13 +125,14 @@
           throws ConfigurationError
       {
           try {
  -            Class spiClass;
  -            if (classLoader == null) {
  -                spiClass = Class.forName(className);
  -            } else {
  -                spiClass = classLoader.loadClass(className);
  +            if (classLoader != null) {
  +                try {
  +                    return classLoader.loadClass(className).newInstance ();
  +                } catch (ClassNotFoundException x) {
  +                      // try again
  +                }
               }
  -            return spiClass.newInstance();
  +            return Class.forName(className).newInstance(); 
           } catch (ClassNotFoundException x) {
               throw new ConfigurationError(
                   "Provider " + className + " not found", x);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.1   +7 -6      xml-commons/java/external/src/javax/xml/transform/FactoryFinder.java
  
  Index: FactoryFinder.java
  ===================================================================
  RCS file: /home/cvs/xml-commons/java/external/src/javax/xml/transform/FactoryFinder.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- FactoryFinder.java	26 Oct 2001 00:23:47 -0000	1.7
  +++ FactoryFinder.java	17 May 2002 16:13:15 -0000	1.7.2.1
  @@ -125,13 +125,14 @@
           throws ConfigurationError
       {
           try {
  -            Class spiClass;
  -            if (classLoader == null) {
  -                spiClass = Class.forName(className);
  -            } else {
  -                spiClass = classLoader.loadClass(className);
  +            if (classLoader != null) {
  +                try {
  +                    return classLoader.loadClass(className).newInstance ();
  +                } catch (ClassNotFoundException x) {
  +                      // try again
  +                }
               }
  -            return spiClass.newInstance();
  +            return Class.forName(className).newInstance(); 
           } catch (ClassNotFoundException x) {
               throw new ConfigurationError(
                   "Provider " + className + " not found", x);
  
  
  

Mime
View raw message