src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java

changeset 408
b0610cd08440
parent 368
0989ad8c0860
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Thu Sep 26 10:43:28 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Fri Oct 04 16:21:34 2013 +0100
     1.3 @@ -75,13 +75,13 @@
     1.4      private Map<String, JavaWsdlMappingType> readers = new HashMap<String, JavaWsdlMappingType>();
     1.5  
     1.6      public ExternalMetadataReader(Collection<File> files, Collection<String> resourcePaths, ClassLoader classLoader,
     1.7 -                                  boolean xsdValidation, boolean disableSecureXmlProcessing) {
     1.8 +                                  boolean xsdValidation, boolean disableXmlSecurity) {
     1.9  
    1.10          if (files != null) {
    1.11              for (File file : files) {
    1.12                  try {
    1.13 -                    String namespace = Util.documentRootNamespace(newSource(file), disableSecureXmlProcessing);
    1.14 -                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(file), namespace, disableSecureXmlProcessing);
    1.15 +                    String namespace = Util.documentRootNamespace(newSource(file), disableXmlSecurity);
    1.16 +                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(file), namespace, disableXmlSecurity);
    1.17                      readers.put(externalMapping.getJavaTypeName(), externalMapping);
    1.18                  } catch (Exception e) {
    1.19                      throw new RuntimeModelerException("runtime.modeler.external.metadata.unable.to.read", file.getAbsolutePath());
    1.20 @@ -92,8 +92,8 @@
    1.21          if (resourcePaths != null) {
    1.22              for (String resourcePath : resourcePaths) {
    1.23                  try {
    1.24 -                    String namespace = Util.documentRootNamespace(newSource(resourcePath, classLoader), disableSecureXmlProcessing);
    1.25 -                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(resourcePath, classLoader), namespace, disableSecureXmlProcessing);
    1.26 +                    String namespace = Util.documentRootNamespace(newSource(resourcePath, classLoader), disableXmlSecurity);
    1.27 +                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(resourcePath, classLoader), namespace, disableXmlSecurity);
    1.28                      readers.put(externalMapping.getJavaTypeName(), externalMapping);
    1.29                  } catch (Exception e) {
    1.30                      throw new RuntimeModelerException("runtime.modeler.external.metadata.unable.to.read", resourcePath);
    1.31 @@ -107,11 +107,11 @@
    1.32          return new StreamSource(is);
    1.33      }
    1.34  
    1.35 -    private JavaWsdlMappingType parseMetadata(boolean xsdValidation, StreamSource source, String namespace, boolean disableSecureXmlProcessing) throws JAXBException, IOException, TransformerException {
    1.36 +    private JavaWsdlMappingType parseMetadata(boolean xsdValidation, StreamSource source, String namespace, boolean disableXmlSecurity) throws JAXBException, IOException, TransformerException {
    1.37          if (NAMESPACE_WEBLOGIC_WSEE_DATABINDING.equals(namespace)) {
    1.38 -            return Util.transformAndRead(source, disableSecureXmlProcessing);
    1.39 +            return Util.transformAndRead(source, disableXmlSecurity);
    1.40          } if (NAMESPACE_JAXWS_RI_EXTERNAL_METADATA.equals(namespace)) {
    1.41 -            return Util.read(source, xsdValidation, disableSecureXmlProcessing);
    1.42 +            return Util.read(source, xsdValidation, disableXmlSecurity);
    1.43          } else {
    1.44              throw new RuntimeModelerException("runtime.modeler.external.metadata.unsupported.schema", namespace, Arrays.asList(NAMESPACE_WEBLOGIC_WSEE_DATABINDING, NAMESPACE_JAXWS_RI_EXTERNAL_METADATA).toString());
    1.45          }
    1.46 @@ -425,8 +425,8 @@
    1.47          }
    1.48  
    1.49          @SuppressWarnings("unchecked")
    1.50 -        public static JavaWsdlMappingType read(Source src, boolean xsdValidation, boolean disableSecureXmlProcessing) throws IOException, JAXBException {
    1.51 -            JAXBContext ctx = jaxbContext(disableSecureXmlProcessing);
    1.52 +        public static JavaWsdlMappingType read(Source src, boolean xsdValidation, boolean disableXmlSecurity) throws IOException, JAXBException {
    1.53 +            JAXBContext ctx = jaxbContext(disableXmlSecurity);
    1.54              try {
    1.55                  Unmarshaller um = ctx.createUnmarshaller();
    1.56                  if (xsdValidation) {
    1.57 @@ -455,16 +455,16 @@
    1.58              }
    1.59          }
    1.60  
    1.61 -        private static JAXBContext jaxbContext(boolean disableSecureXmlProcessing) {
    1.62 +        private static JAXBContext jaxbContext(boolean disableXmlSecurity) {
    1.63              // as it is supposed to have security enabled in most cases, we create and don't cache
    1.64              // "insecure" JAXBContext - these should be corner cases
    1.65 -            return disableSecureXmlProcessing ? createJaxbContext(true) : jaxbContext;
    1.66 +            return disableXmlSecurity ? createJaxbContext(true) : jaxbContext;
    1.67          }
    1.68  
    1.69 -        public static JavaWsdlMappingType transformAndRead(Source src, boolean disableSecureXmlProcessing) throws TransformerException, JAXBException {
    1.70 +        public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws TransformerException, JAXBException {
    1.71              Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
    1.72 -            JAXBResult result = new JAXBResult(jaxbContext(disableSecureXmlProcessing));
    1.73 -            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableSecureXmlProcessing);
    1.74 +            JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
    1.75 +            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
    1.76              Transformer transformer = tf.newTemplates(xsl).newTransformer();
    1.77              transformer.transform(src, result);
    1.78              return getJavaWsdlMapping(result.getResult());
    1.79 @@ -534,9 +534,9 @@
    1.80              return elems.toArray(new Element[elems.size()]);
    1.81          }
    1.82  
    1.83 -        static String documentRootNamespace(Source src, boolean disableSecureXmlProcessing) throws XMLStreamException {
    1.84 +        static String documentRootNamespace(Source src, boolean disableXmlSecurity) throws XMLStreamException {
    1.85              XMLInputFactory factory;
    1.86 -            factory = XmlUtil.newXMLInputFactory(!disableSecureXmlProcessing);
    1.87 +            factory = XmlUtil.newXMLInputFactory(!disableXmlSecurity);
    1.88              XMLStreamReader streamReader = factory.createXMLStreamReader(src);
    1.89              XMLStreamReaderUtil.nextElementContent(streamReader);
    1.90              String namespaceURI = streamReader.getName().getNamespaceURI();

mercurial