src/share/jaxws_classes/com/sun/xml/internal/xsom/util/DomAnnotationParserFactory.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -27,10 +27,11 @@
 
 import com.sun.xml.internal.xsom.XSAnnotation;
 import com.sun.xml.internal.xsom.parser.AnnotationContext;
 import com.sun.xml.internal.xsom.parser.AnnotationParser;
 import com.sun.xml.internal.xsom.parser.AnnotationParserFactory;
+import javax.xml.XMLConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.EntityResolver;

@@ -54,14 +55,19 @@
  * one <xs:annotation> element.
  *
  * @author Kohsuke Kawaguchi
  */
 public class DomAnnotationParserFactory implements AnnotationParserFactory {
+
     public AnnotationParser create() {
         return new AnnotationParserImpl();
     }
 
+    public AnnotationParser create(boolean disableSecureProcessing) {
+        return new AnnotationParserImpl();
+    }
+
     private static final SAXTransformerFactory stf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
 
     private static class AnnotationParserImpl extends AnnotationParser {
 
         /**

@@ -69,12 +75,17 @@
          */
         private final TransformerHandler transformer;
         private DOMResult result;
 
         AnnotationParserImpl() {
+            this(false);
+        }
+
+        AnnotationParserImpl(boolean disableSecureProcessing) {
             try {
                 transformer = stf.newTransformerHandler();
+                stf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, disableSecureProcessing);
             } catch (TransformerConfigurationException e) {
                 throw new Error(e); // impossible
             }
         }