format, fix some typos, use log placeholders
@@ -63,8 +63,7 @@ public final class XmlUtil {
* @param requestedNodes requested nodes on the xml file
* @return the requested nodes of the XML file.
*/
- public static List<Element> parse( final String xml, final String requestedNodes )
- {
+ public static List< Element > parse( final String xml, final String requestedNodes ) {
if( StringUtils.isNotEmpty( xml ) && StringUtils.isNotEmpty( requestedNodes ) ) {
final Set< Element > readed = new HashSet<>();
final SAXBuilder builder = new SAXBuilder();
@@ -72,7 +71,7 @@ public final class XmlUtil {
final Enumeration< URL > resources = XmlUtil.class.getClassLoader().getResources( xml );
while( resources.hasMoreElements() ) {
final URL resource = resources.nextElement();
- LOG.debug( "reading " + resource.toString() );
+ LOG.debug( "reading {}", resource.toString() );
final Document doc = builder.build( resource );
final XPathFactory xpfac = XPathFactory.instance();
final XPathExpression<Element> xp = xpfac.compile( requestedNodes, Filters.element() );
@@ -80,9 +79,9 @@ public final class XmlUtil {
}
return new ArrayList<>( readed );
} catch( final IOException ioe ) {
- LOG.error( "Couldn't load all " + xml + " resources", ioe );
+ LOG.error( "Couldn't load all {} resources", xml, ioe );
} catch( final JDOMException jdome ) {
- LOG.error( "error parsing " + xml + " resources", jdome );
+ LOG.error( "error parsing {} resources", xml, jdome );
}
}
return Collections.emptyList();
@@ -105,16 +104,16 @@ public final class XmlUtil {
final XPathExpression< Element > xp = xpfac.compile( requestedNodes, Filters.element() );
return xp.evaluate( doc );
} catch( final IOException ioe ) {
- LOG.error( "Couldn't load all " + xmlStream + " resources", ioe );
+ LOG.error( "Couldn't load all {} resources", xmlStream, ioe );
} catch( final JDOMException jdome ) {
- LOG.error( "error parsing " + xmlStream + " resources", jdome );
+ LOG.error( "error parsing {} resources", xmlStream, jdome );
}
}
return Collections.emptyList();
}
/**
- * Renders all the text() nodes from the DOM tree. This is very useful for cleaning away all of the XHTML.
+ * Renders all the text() nodes from the DOM tree. This is very useful for cleaning away all the XHTML.
*
* @param doc Dom tree
* @return String containing only the text from the provided Dom tree.
