Skip to content

Commit a4c74ab

Browse files
authored
Merge pull request #2271 from adamretter/hotfix/sax-parser-logging
Fix verbose logging regression in ExistSAXParserFactory
2 parents 20053ff + 45c129b commit a4c74ab

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/org/exist/util/ExistSAXParserFactory.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public static SAXParserFactory getSAXParserFactory(final String className) {
5353

5454
} catch (final ClassNotFoundException ex) {
5555
// quick escape
56-
LOG.debug(className + ": " + ex.getMessage(), ex);
56+
if (LOG.isDebugEnabled()) {
57+
LOG.debug(className + ": " + ex.getMessage(), ex);
58+
}
5759
return null;
5860
}
5961

@@ -63,7 +65,9 @@ public static SAXParserFactory getSAXParserFactory(final String className) {
6365
method = clazz.getMethod("newInstance", (Class[]) null);
6466
} catch (final SecurityException | NoSuchMethodException ex) {
6567
// quick escape
66-
LOG.debug("Method " + className + ".newInstance not found.", ex);
68+
if (LOG.isDebugEnabled()) {
69+
LOG.debug("Method " + className + ".newInstance not found.", ex);
70+
}
6771
return null;
6872
}
6973

@@ -74,12 +78,16 @@ public static SAXParserFactory getSAXParserFactory(final String className) {
7478

7579
} catch (final IllegalAccessException | InvocationTargetException ex) {
7680
// quick escape
77-
LOG.debug("Could not invoke method " + className + ".newInstance.", ex);
81+
if (LOG.isDebugEnabled()) {
82+
LOG.debug("Could not invoke method " + className + ".newInstance.", ex);
83+
}
7884
return null;
7985
}
8086

8187
if (!(result instanceof SAXParserFactory)) {
82-
LOG.debug("Could not create instance of SAXParserFactory: " + result.toString());
88+
if (LOG.isDebugEnabled()) {
89+
LOG.debug("Could not create instance of SAXParserFactory: " + result.toString());
90+
}
8391
return null;
8492
}
8593

@@ -108,7 +116,9 @@ public static SAXParserFactory getSAXParserFactory() {
108116
// If no factory could be retrieved, create system default property.
109117
if (factory == null) {
110118
factory = SAXParserFactory.newInstance();
111-
LOG.info(String.format("Using default SAXParserFactory '%s'", factory.getClass().getCanonicalName()));
119+
if (LOG.isDebugEnabled()) {
120+
LOG.debug(String.format("Using default SAXParserFactory '%s'", factory.getClass().getCanonicalName()));
121+
}
112122
}
113123

114124
return factory;

0 commit comments

Comments
 (0)