src/share/jaxws_classes/com/sun/tools/internal/xjc/ModelLoader.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
     1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/ModelLoader.java	Thu Apr 04 19:05:24 2013 -0700
     1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/ModelLoader.java	Tue Apr 09 14:51:13 2013 +0100
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -47,12 +47,11 @@
    1.11  import com.sun.tools.internal.xjc.reader.xmlschema.parser.SchemaConstraintChecker;
    1.12  import com.sun.tools.internal.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic;
    1.13  import com.sun.tools.internal.xjc.util.ErrorReceiverFilter;
    1.14 +import com.sun.xml.internal.bind.v2.util.XmlFactory;
    1.15  import com.sun.xml.internal.xsom.XSSchemaSet;
    1.16  import com.sun.xml.internal.xsom.parser.JAXPParser;
    1.17  import com.sun.xml.internal.xsom.parser.XMLParser;
    1.18  import com.sun.xml.internal.xsom.parser.XSOMParser;
    1.19 -import java.net.URI;
    1.20 -import java.net.URISyntaxException;
    1.21  import javax.xml.XMLConstants;
    1.22  
    1.23  import com.sun.xml.internal.rngom.ast.builder.SchemaBuilder;
    1.24 @@ -298,7 +297,7 @@
    1.25          throws SAXException {
    1.26  
    1.27          // parse into DOM forest
    1.28 -        DOMForest forest = new DOMForest(logic);
    1.29 +        DOMForest forest = new DOMForest(logic, opt);
    1.30  
    1.31          forest.setErrorHandler(errorReceiver);
    1.32          if(opt.entityResolver!=null)
    1.33 @@ -343,7 +342,7 @@
    1.34       */
    1.35      public XSSchemaSet loadXMLSchema() throws SAXException {
    1.36  
    1.37 -        if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver)) {
    1.38 +        if( opt.strictCheck && !SchemaConstraintChecker.check(opt.getGrammars(),errorReceiver,opt.entityResolver, opt.disableXmlSecurity)) {
    1.39              // schema error. error should have been reported
    1.40              return null;
    1.41          }
    1.42 @@ -353,7 +352,7 @@
    1.43              // which is faster if the speculation succeeds.
    1.44              try {
    1.45                  return createXSOMSpeculative();
    1.46 -            } catch( SpeculationFailure _ ) {
    1.47 +            } catch( SpeculationFailure e) {
    1.48                  // failed. go the slow way
    1.49              }
    1.50          }
    1.51 @@ -411,6 +410,13 @@
    1.52          return BGMBuilder.build(xs, codeModel, errorReceiver, opt);
    1.53      }
    1.54  
    1.55 +    /**
    1.56 +     * Potentially problematic - make sure the parser instance passed is initialized
    1.57 +     * with proper security feature.
    1.58 +     *
    1.59 +     * @param parser
    1.60 +     * @return
    1.61 +     */
    1.62      public XSOMParser createXSOMParser(XMLParser parser) {
    1.63          // set up other parameters to XSOMParser
    1.64          XSOMParser reader = new XSOMParser(new XMLSchemaParser(parser));
    1.65 @@ -465,7 +471,7 @@
    1.66          // check if the schema contains external binding files. If so, speculation is a failure.
    1.67  
    1.68          XMLParser parser = new XMLParser() {
    1.69 -            private final JAXPParser base = new JAXPParser();
    1.70 +            private final JAXPParser base = new JAXPParser(XmlFactory.createParserFactory(opt.disableXmlSecurity));
    1.71  
    1.72              public void parse(InputSource source, ContentHandler handler,
    1.73                  ErrorHandler errorHandler, EntityResolver entityResolver ) throws SAXException, IOException {

mercurial