< prev index next >

src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -286,11 +286,15 @@
         Class<?> clazz = createClass(className);
         if (clazz == null) {
             debugPrintln("failed to getClass(" + className + ")");
             return null;
         }
-        debugPrintln("loaded " + className + " from " + which(clazz));
+        // SecuritySupport::getClassSource is expensive and can result in unnecessary
+        // I/O. It needs to be called only when 'debug' flag is set
+        if (debug) {
+            debugPrintln("loaded " + className + " from " + ss.getClassSource(clazz));
+        }
 
         // instantiate Class as a XPathFactory
         try {
             if (!useServicesMechanism) {
                 xPathFactory = newInstanceNoServiceLoader(clazz);

@@ -410,12 +414,6 @@
             throw new XPathFactoryConfigurationException(error);
         }
     }
 
     private static final Class<XPathFactory> SERVICE_CLASS = XPathFactory.class;
-
-    // Used for debugging purposes
-    private static String which( Class<?> clazz ) {
-        return ss.getClassSource(clazz);
-    }
-
 }
< prev index next >