Author: mrglavas
Date: Wed Mar 17 14:36:25 2010
New Revision: 924308
URL: http://svn.apache.org/viewvc?rev=924308&view=rev
Log:
Allow the debug flag in ObjectFactory to be configured with a system property
(called xerces.debug) to make it easier for applications to troubleshoot the
discovery and loading of XMLParserConfigurations.
Modified:
xerces/java/trunk/samples/xni/ObjectFactory.java
Modified: xerces/java/trunk/samples/xni/ObjectFactory.java
URL:
http://svn.apache.org/viewvc/xerces/java/trunk/samples/xni/ObjectFactory.java?rev=924308&r1=924307&r2=924308&view=diff
==============================================================================
--- xerces/java/trunk/samples/xni/ObjectFactory.java (original)
+++ xerces/java/trunk/samples/xni/ObjectFactory.java Wed Mar 17 14:36:25 2010
@@ -52,7 +52,7 @@ final class ObjectFactory {
private static final String DEFAULT_PROPERTIES_FILENAME =
"xerces.properties";
/** Set to true for debugging */
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = isDebugEnabled();
/**
* Default columns per line.
@@ -256,11 +256,22 @@ final class ObjectFactory {
//
// Private static methods
//
+
+ /** Returns true if debug has been enabled. */
+ private static boolean isDebugEnabled() {
+ try {
+ String val = SecuritySupport.getSystemProperty("xerces.debug");
+ // Allow simply setting the prop to turn on debug
+ return (val != null && (!"false".equals(val)));
+ }
+ catch (SecurityException se) {}
+ return false;
+ } // isDebugEnabled()
/** Prints a message to standard error if debugging is enabled. */
private static void debugPrintln(String msg) {
if (DEBUG) {
- System.err.println("JAXP: " + msg);
+ System.err.println("XERCES: " + msg);
}
} // debugPrintln(String)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]