< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java

Print this page

        

@@ -27,21 +27,19 @@
 import java.io.InputStream;
 import java.io.Reader;
 
 import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamReader;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stax.StAXResult;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
 
 import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
 import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;

@@ -109,12 +107,12 @@
                            reader= XMLReaderFactory.createXMLReader();
                            try {
                                 reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
                                             xsltc.isSecureProcessing());
                            } catch (SAXNotRecognizedException e) {
-                                System.err.println("Warning:  " + reader.getClass().getName() + ": "
-                                        + e.getMessage());
+                                XMLSecurityManager.printWarning(reader.getClass().getName(),
+                                        XMLConstants.FEATURE_SECURE_PROCESSING, e);
                            }
                        } catch (Exception e ) {
                            try {
 
                                //Incase there is an exception thrown

@@ -147,29 +145,31 @@
 
                     try {
                         reader.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
                                    xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_DTD));
                     } catch (SAXNotRecognizedException e) {
-                        System.err.println("Warning:  " + reader.getClass().getName() + ": "
-                                + e.getMessage());
+                        XMLSecurityManager.printWarning(reader.getClass().getName(),
+                                XMLConstants.ACCESS_EXTERNAL_DTD, e);
                     }
 
+                    String lastProperty = "";
                     try {
                         XMLSecurityManager securityManager =
                                 (XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
                         if (securityManager != null) {
                             for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
-                                reader.setProperty(limit.apiProperty(),
+                                lastProperty = limit.apiProperty();
+                                reader.setProperty(lastProperty,
                                         securityManager.getLimitValueAsString(limit));
                             }
                             if (securityManager.printEntityCountInfo()) {
+                                lastProperty = XalanConstants.JDK_ENTITY_COUNT_INFO;
                                 reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
                             }
                         }
                     } catch (SAXException se) {
-                        System.err.println("Warning:  " + reader.getClass().getName() + ": "
-                                    + se.getMessage());
+                        XMLSecurityManager.printWarning(reader.getClass().getName(), lastProperty, se);
                     }
                     xsltc.setXMLReader(reader);
                 }catch (SAXNotRecognizedException snre ) {
                   throw new TransformerConfigurationException
                        ("SAXNotRecognizedException ",snre);
< prev index next >