--- old/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java 2016-02-03 20:49:38.634394837 +0300 +++ new/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java 2016-02-03 20:49:38.558394840 +0300 @@ -26,6 +26,8 @@ package com.sun.org.apache.xalan.internal.utils; import com.sun.org.apache.xalan.internal.XalanConstants; +import java.util.concurrent.CopyOnWriteArrayList; +import org.xml.sax.SAXException; /** @@ -415,6 +417,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 *