diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/resource/XMLResource.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/resource/XMLResource.java index 6d3b8250a..4d55fd9d1 100644 --- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/resource/XMLResource.java +++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/resource/XMLResource.java @@ -19,25 +19,6 @@ */ package org.xhtmlrenderer.resource; -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.lang.ref.Reference; -import java.lang.ref.SoftReference; -import java.util.Queue; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.logging.Level; - -import javax.xml.XMLConstants; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXSource; - import org.w3c.dom.Document; import org.xhtmlrenderer.util.Configuration; import org.xhtmlrenderer.util.XRLog; @@ -54,6 +35,24 @@ import org.xml.sax.helpers.XMLFilterImpl; import org.xml.sax.helpers.XMLReaderFactory; +import javax.xml.XMLConstants; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.sax.SAXSource; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.lang.ref.Reference; +import java.lang.ref.SoftReference; +import java.util.Queue; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.logging.Level; + /** * @author Patrick Wright @@ -224,7 +223,7 @@ private Document transform(Source source) { return (Document) result.getNode(); } - } // class XMLResourceBuilder + } private static class XMLReaderPool extends ObjectPool { @@ -330,7 +329,7 @@ private void setFeature(XMLReader xmlReader, String featureUri, boolean value) { } } - } // class XMLReaderPool + } private static class WhitespacePreservingFilter @@ -374,7 +373,7 @@ public InputSource resolveEntity(String name, return resolveEntity(publicId, systemId); } - } // class SpacePreservingFilter + } private static class IdentityTransformerPool extends ObjectPool { @@ -407,7 +406,7 @@ protected Transformer newValue() { } } - } // class TranformerPool + } private static abstract class ObjectPool { @@ -415,7 +414,7 @@ private static abstract class ObjectPool { private final Queue> pool; ObjectPool(int capacity) { - pool = new ArrayBlockingQueue>(capacity); + pool = new ArrayBlockingQueue<>(capacity); } protected abstract T newValue(); @@ -434,10 +433,10 @@ T get() { } void release(T obj) { - pool.offer(new SoftReference(obj)); + pool.offer(new SoftReference<>(obj)); } - } // class ObjectPool + } } diff --git a/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/XRLog.java b/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/XRLog.java index 7d796e18a..c44c73f94 100644 --- a/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/XRLog.java +++ b/flying-saucer-core/src/main/java/org/xhtmlrenderer/util/XRLog.java @@ -34,7 +34,7 @@ */ public class XRLog { - private static final List LOGGER_NAMES = new ArrayList(20); + private static final List LOGGER_NAMES = new ArrayList<>(20); public static final String CONFIG = registerLoggerByName("org.xhtmlrenderer.config"); public static final String EXCEPTION = registerLoggerByName("org.xhtmlrenderer.exception"); public static final String GENERAL = registerLoggerByName("org.xhtmlrenderer.general"); @@ -67,7 +67,7 @@ private static String registerLoggerByName(final String loggerName) { */ public static List listRegisteredLoggers() { // defensive copy - return new ArrayList(LOGGER_NAMES); + return new ArrayList<>(LOGGER_NAMES); } @@ -299,7 +299,7 @@ public static synchronized void setLoggerImpl(XRLogger loggerImpl) { * * $Log$ * Revision 1.20 2010/01/13 01:28:46 peterbrant - * Add synchronization to XRLog#log to avoid spurious errors on initializatoin + * Add synchronization to XRLog#log to avoid spurious errors on initialization * * Revision 1.19 2008/01/27 16:40:29 pdoubleya * Issues 186 and 130: fix configuration so that logging setup does not override any current settings for JDK logging classes. Disable logging by default. @@ -314,7 +314,7 @@ public static synchronized void setLoggerImpl(XRLogger loggerImpl) { * CSS parsing errors should be logged at WARNING, not INFO level * * Revision 1.15 2006/08/17 17:32:25 joshy - * intial patch to fix the logging config issues + * initial patch to fix the logging config issues * https://xhtmlrenderer.dev.java.net/issues/show_bug.cgi?id=130 * * Revision 1.14 2006/07/26 17:59:01 pdoubleya