< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java

Print this page

        

*** 25,34 **** --- 25,36 ---- package com.sun.org.apache.xerces.internal.utils; import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.SecurityManager; + import java.util.concurrent.CopyOnWriteArrayList; + import org.xml.sax.SAXException; /** * This class manages standard and implementation-specific limitations. * */
*** 494,503 **** --- 496,522 ---- } } } + // Array list to store printed warnings for each SAX parser used + private static final CopyOnWriteArrayList<String> printedWarnings = new CopyOnWriteArrayList<>(); + + /** + * Prints out warnings if a parser does not support the specified feature/property. + * + * @param parserClassName the name of the parser class + * @param propertyName the property name + * @param exception the exception thrown by the parser + */ + public static void printWarning(String parserClassName, String propertyName, SAXException exception) { + String key = parserClassName+":"+propertyName; + if (printedWarnings.addIfAbsent(key)) { + System.err.println( "Warning: "+parserClassName+": "+exception.getMessage()); + } + } + /** * Read from system properties, or those in jaxp.properties * * @param property the type of the property * @param sysPropertyName the name of system property
< prev index next >