< prev index next >

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

Print this page
rev 1063 : 8172974: [JAXP] XALAN: Wrong result when transforming namespace unaware StAX Input

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

@@ -93,17 +93,14 @@
  * @author Morten Jorgensen
  * @author G. Todd Miller
  * @author Santiago Pericas-Geertsen
  */
 public final class TransformerImpl extends Transformer
-    implements DOMCache, ErrorListener
-{
+    implements DOMCache, ErrorListener {
 
     private final static String LEXICAL_HANDLER_PROPERTY =
         "http://xml.org/sax/properties/lexical-handler";
-    private static final String NAMESPACE_FEATURE =
-        "http://xml.org/sax/features/namespaces";
 
     /**
      * Namespace prefixes feature for {@link XMLReader}.
      */
     private static final String NAMESPACE_PREFIXES_FEATURE =

@@ -158,11 +155,11 @@
      * Number of indent spaces to add when indentation is on.
      */
     private int _indentNumber = -1;
 
     /**
-     * A reference to the transformer factory that this templates
+     * A reference to the transformer factory that this transformer
      * object belongs to.
      */
     private TransformerFactoryImpl _tfactory = null;
 
     /**

@@ -180,15 +177,10 @@
      * A reference to an object that creates and caches XMLReader objects.
      */
     private XMLReaderManager _readerManager;
 
     /**
-     * A flag indicating whether we use incremental building of the DTM.
-     */
-    //private boolean _isIncremental = false;
-
-    /**
      * A flag indicating whether this transformer implements the identity
      * transform.
      */
     private boolean _isIdentity = false;
 

@@ -198,23 +190,21 @@
     private boolean _isSecureProcessing = false;
 
     /**
      * Indicates whether implementation parts should use
      *   service loader (or similar).
-     * Note the default value (false) is the safe option..
+     * Note the default value (false) is the safe option.
      */
     private boolean _useServicesMechanism;
+
     /**
-     * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
-     */
-    private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
-     /**
      * protocols allowed for external DTD references in source file and/or stylesheet.
      */
     private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
 
     private XMLSecurityManager _securityManager;
+
     /**
      * A map to store parameters for the identity transform. These
      * are not needed during the transformation, but we must keep track of
      * them to be fully complaint with the JAXP API.
      */

@@ -244,12 +234,11 @@
 
         @Override
         public void displayMessage(String msg) {
             if(_errorListener == null) {
                 System.err.println(msg);
-            }
-            else {
+            } else {
                 try {
                     _errorListener.warning(new TransformerException(msg));
                 }
                 catch (TransformerException e) {
                     // ignored

@@ -261,11 +250,10 @@
     protected TransformerImpl(Properties outputProperties, int indentNumber,
         TransformerFactoryImpl tfactory)
     {
         this(null, outputProperties, indentNumber, tfactory);
         _isIdentity = true;
-        // _properties.put(OutputKeys.METHOD, "xml");
     }
 
     protected TransformerImpl(Translet translet, Properties outputProperties,
         int indentNumber, TransformerFactoryImpl tfactory)
     {

@@ -273,11 +261,10 @@
         _properties = createOutputProperties(outputProperties);
         _propertiesClone = (Properties) _properties.clone();
         _indentNumber = indentNumber;
         _tfactory = tfactory;
         _useServicesMechanism = _tfactory.useServicesMechnism();
-        _accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
         _accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
         _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
         _readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
         _readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
         _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);

@@ -293,11 +280,10 @@
             if (catalogFiles != null) {
                 _readerManager.setFeature(XMLConstants.USE_CATALOG, _useCatalog);
                 _readerManager.setProperty(JdkXmlFeatures.CATALOG_FEATURES, _catalogFeatures);
             }
         }
-        //_isIncremental = tfactory._incremental;
     }
 
     /**
      * Return the state of the secure processing feature.
      */

@@ -594,12 +580,11 @@
                 _translet.prepassDocument(dom);
             }
 
             return dom;
 
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             if (_errorListener != null) {
                 postErrorToListener(e.getMessage());
             }
             throw new TransformerException(e);
         }

@@ -851,22 +836,10 @@
             // ignored - transformation cannot be continued
         }
     }
 
     /**
-     * Inform TrAX error listener of a warning
-     */
-    private void postWarningToListener(String message) {
-        try {
-            _errorListener.warning(new TransformerException(message));
-        }
-        catch (TransformerException e) {
-            // ignored - transformation cannot be continued
-        }
-    }
-
-    /**
      * Implements JAXP's Transformer.getOutputProperties().
      * Returns a copy of the output properties for the transformation. This is
      * a set of layered properties. The first layer contains properties set by
      * calls to setOutputProperty() and setOutputProperties() on this class,
      * and the output settings defined in the stylesheet's <xsl:output>

@@ -912,11 +885,11 @@
     @Override
     public void setOutputProperties(Properties properties)
         throws IllegalArgumentException
     {
         if (properties != null) {
-            final Enumeration names = properties.propertyNames();
+            final Enumeration<?> names = properties.propertyNames();
 
             while (names.hasMoreElements()) {
                 final String name = (String) names.nextElement();
 
                 // Ignore lower layer properties

@@ -965,11 +938,11 @@
     {
         // Return right now if no properties are set
         if (_properties == null) return;
 
         // Get a list of all the defined properties
-        Enumeration names = _properties.propertyNames();
+        Enumeration<?> names = _properties.propertyNames();
         while (names.hasMoreElements()) {
             // Note the use of get() instead of getProperty()
             String name  = (String) names.nextElement();
             String value = (String) _properties.get(name);
 

@@ -1044,11 +1017,11 @@
 
         String doctypePublic = null;
         String doctypeSystem = null;
 
         // Get a list of all the defined properties
-        Enumeration names = _properties.propertyNames();
+        Enumeration<?> names = _properties.propertyNames();
         while (names.hasMoreElements()) {
             // Note the use of get() instead of getProperty()
             String name  = (String) names.nextElement();
             String value = (String) _properties.get(name);
 

@@ -1145,11 +1118,11 @@
         setDefaults(defaults, "xml");
 
         // Copy propeties set in stylesheet to base
         final Properties base = new Properties(defaults);
         if (outputProperties != null) {
-            final Enumeration names = outputProperties.propertyNames();
+            final Enumeration<?> names = outputProperties.propertyNames();
             while (names.hasMoreElements()) {
                 final String name = (String) names.nextElement();
                 base.setProperty(name, outputProperties.getProperty(name));
             }
         }

@@ -1182,11 +1155,11 @@
         private void setDefaults(Properties props, String method)
         {
                 final Properties method_props =
                         OutputPropertiesFactory.getDefaultMethodProperties(method);
                 {
-                        final Enumeration names = method_props.propertyNames();
+                        final Enumeration<?> names = method_props.propertyNames();
                         while (names.hasMoreElements())
                         {
                                 final String name = (String)names.nextElement();
                                 props.setProperty(name, method_props.getProperty(name));
                         }
< prev index next >