You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2006/04/07 23:10:58 UTC
svn commit: r392401 - in
/xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml:
parsers/FactoryFinder.java transform/FactoryFinder.java
Author: mrglavas
Date: Fri Apr 7 14:10:57 2006
New Revision: 392401
URL: http://svn.apache.org/viewcvs?rev=392401&view=rev
Log:
Reducing creation of short lived objects. The debug print method
calls were creating instances of StringBuffer and String which
are never read.
Modified:
xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/parsers/FactoryFinder.java
xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/transform/FactoryFinder.java
Modified: xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/parsers/FactoryFinder.java
URL: http://svn.apache.org/viewcvs/xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/parsers/FactoryFinder.java?rev=392401&r1=392400&r2=392401&view=diff
==============================================================================
--- xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/parsers/FactoryFinder.java (original)
+++ xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/parsers/FactoryFinder.java Fri Apr 7 14:10:57 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,13 +105,13 @@
cl = FactoryFinder.class.getClassLoader();
}
- dPrint("find factoryId=" + factoryId);
+ if (debug) dPrint("find factoryId=" + factoryId);
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
if (systemProp != null) {
- dPrint("found system property, value=" + systemProp);
+ if (debug) dPrint("found system property, value=" + systemProp);
return newInstance(systemProp, cl, true);
}
} catch (SecurityException se) {
@@ -193,7 +193,7 @@
if (jaxpProperties != null) {
String factoryClassName = jaxpProperties.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in jaxp.properties, value=" + factoryClassName);
+ if (debug) dPrint("found in jaxp.properties, value=" + factoryClassName);
return newInstance(factoryClassName, cl, true);
}
}
@@ -209,7 +209,7 @@
"Provider for " + factoryId + " cannot be found", null);
}
- dPrint("using fallback, value=" + fallbackClassName);
+ if (debug) dPrint("using fallback, value=" + fallbackClassName);
return newInstance(fallbackClassName, cl, true);
}
@@ -268,7 +268,7 @@
}
}
Object instance = providerClass.newInstance();
- dPrint("created new instance of " + providerClass +
+ if (debug) dPrint("created new instance of " + providerClass +
" using ClassLoader: " + cl);
return instance;
} catch (ClassNotFoundException x) {
@@ -315,7 +315,7 @@
return null;
}
- dPrint("found jar resource=" + serviceId +
+ if (debug) dPrint("found jar resource=" + serviceId +
" using ClassLoader: " + cl);
// Read the service provider name in UTF-8 as specified in
@@ -361,7 +361,7 @@
if (factoryClassName != null &&
! "".equals(factoryClassName)) {
- dPrint("found in resource, value="
+ if (debug) dPrint("found in resource, value="
+ factoryClassName);
// Note: here we do not want to fall back to the current
Modified: xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/transform/FactoryFinder.java
URL: http://svn.apache.org/viewcvs/xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/transform/FactoryFinder.java?rev=392401&r1=392400&r2=392401&view=diff
==============================================================================
--- xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/transform/FactoryFinder.java (original)
+++ xml/commons/branches/tck-jaxp-1_2_0/java/external/src/javax/xml/transform/FactoryFinder.java Fri Apr 7 14:10:57 2006
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2004,2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -105,13 +105,13 @@
cl = FactoryFinder.class.getClassLoader();
}
- dPrint("find factoryId=" + factoryId);
+ if (debug) dPrint("find factoryId=" + factoryId);
// Use the system property first
try {
String systemProp = ss.getSystemProperty(factoryId);
if (systemProp != null) {
- dPrint("found system property, value=" + systemProp);
+ if (debug) dPrint("found system property, value=" + systemProp);
return newInstance(systemProp, cl, true);
}
} catch (SecurityException se) {
@@ -193,7 +193,7 @@
if (jaxpProperties != null) {
String factoryClassName = jaxpProperties.getProperty(factoryId);
if (factoryClassName != null) {
- dPrint("found in jaxp.properties, value=" + factoryClassName);
+ if (debug) dPrint("found in jaxp.properties, value=" + factoryClassName);
return newInstance(factoryClassName, cl, true);
}
}
@@ -209,7 +209,7 @@
"Provider for " + factoryId + " cannot be found", null);
}
- dPrint("using fallback, value=" + fallbackClassName);
+ if (debug) dPrint("using fallback, value=" + fallbackClassName);
return newInstance(fallbackClassName, cl, true);
}
@@ -268,7 +268,7 @@
}
}
Object instance = providerClass.newInstance();
- dPrint("created new instance of " + providerClass +
+ if (debug) dPrint("created new instance of " + providerClass +
" using ClassLoader: " + cl);
return instance;
} catch (ClassNotFoundException x) {
@@ -315,7 +315,7 @@
return null;
}
- dPrint("found jar resource=" + serviceId +
+ if (debug) dPrint("found jar resource=" + serviceId +
" using ClassLoader: " + cl);
// Read the service provider name in UTF-8 as specified in
@@ -361,7 +361,7 @@
if (factoryClassName != null &&
! "".equals(factoryClassName)) {
- dPrint("found in resource, value="
+ if (debug) dPrint("found in resource, value="
+ factoryClassName);
// Note: here we do not want to fall back to the current