--- old/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java 2016-02-03 20:49:40.330394776 +0300 +++ new/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java 2016-02-03 20:49:40.254394779 +0300 @@ -27,6 +27,8 @@ 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. @@ -496,6 +498,23 @@ } + // Array list to store printed warnings for each SAX parser used + private static final CopyOnWriteArrayList 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 *