--- old/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/WSDLParser.java 2013-04-04 15:26:59.396612646 +0200 +++ new/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/WSDLParser.java 2013-04-04 15:26:59.344612645 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, 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 @@ -58,11 +58,9 @@ import com.sun.tools.internal.ws.wsdl.framework.ParserListener; import com.sun.tools.internal.ws.wsdl.framework.TWSDLParserContextImpl; import com.sun.xml.internal.ws.util.ServiceFinder; - import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.Locator; @@ -73,6 +71,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import org.w3c.dom.Node; /** * A parser for WSDL documents. This parser is used only at the tool time. @@ -101,9 +100,10 @@ if (forest == null) { forest = new MetadataFinder(new WSDLInternalizationLogic(), options, errReceiver); forest.parseWSDL(); - if (forest.isMexMetadata) + if (forest.isMexMetadata) { errReceiver.reset(); } + } this.forest = forest; // register handlers for default extensions register(new SOAPExtensionHandler(extensionHandlers)); @@ -111,7 +111,10 @@ register(new MIMEExtensionHandler(extensionHandlers)); register(new JAXWSBindingExtensionHandler(extensionHandlers)); register(new SOAP12ExtensionHandler(extensionHandlers)); - register(new MemberSubmissionAddressingExtensionHandler(extensionHandlers, errReceiver)); + + // MemberSubmission Addressing not supported by WsImport anymore see JAX_WS-1040 for details + //register(new MemberSubmissionAddressingExtensionHandler(extensionHandlers, errReceiver, options.isExtensionMode())); + register(new W3CAddressingExtensionHandler(extensionHandlers, errReceiver)); register(new W3CAddressingMetadataExtensionHandler(extensionHandlers, errReceiver)); register(new Policy12ExtensionHandler()); @@ -144,7 +147,7 @@ Document root = forest.parse(value, false); if(root==null) continue; // error must have been reported Element binding = root.getDocumentElement(); - if (!fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) + if (!Internalizer.fixNull(binding.getNamespaceURI()).equals(JAXWSBindingsConstants.NS_JAXWS_BINDINGS) || !binding.getLocalName().equals("bindings")){ errReceiver.error(forest.locatorTable.getStartLocation(binding), WsdlMessages.PARSER_NOT_A_BINDING_FILE( binding.getNamespaceURI(), @@ -162,11 +165,6 @@ return buildWSDLDocument(); } - private String fixNull(String s) { - if(s==null) return ""; - else return s; - } - public MetadataFinder getDOMForest() { return forest; } @@ -203,13 +201,6 @@ new Internalizer(forest, options, errReceiver).transform(); - //print the wsdl -// try{ -// forest.dump(System.out); -// }catch(IOException e){ -// e.printStackTrace(); -// } - Definitions definitions = parseDefinitionsNoImport(context, root); if(definitions == null){ Locator locator = forest.locatorTable.getStartLocation(root.getDocumentElement()); @@ -221,20 +212,6 @@ return definitions; } - private void processMexDocs(TWSDLParserContextImpl context){ - for(String location : forest.listSystemIDs()){ - if (!context.getDocument().isImportedDocument(location)){ - Document doc = forest.get(location); - if(doc == null) - continue; - Definitions importedDefinitions = parseDefinitionsNoImport(context, doc); - if(importedDefinitions == null) - continue; - context.getDocument().addImportedEntity(importedDefinitions); - context.getDocument().addImportedDocument(location); - } - } - } private void processImports(TWSDLParserContextImpl context) { for(String location : forest.getExternalReferences()){ if (!context.getDocument().isImportedDocument(location)){ @@ -520,10 +497,7 @@ // possible extensibility element -- must live outside the WSDL namespace checkNotWsdlAttribute(e3); - if (!handleExtension(context, input, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } + handleExtension(context, input, e3, e2); } // verify that there is at most one child element and it is a documentation element @@ -582,10 +556,7 @@ // possible extensibility element -- must live outside the WSDL namespace checkNotWsdlAttribute(e3); - if (!handleExtension(context, output, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } + handleExtension(context, output, e3, e2); } // verify that there is at most one child element and it is a documentation element @@ -635,10 +606,7 @@ // possible extensibility element -- must live outside the WSDL namespace checkNotWsdlAttribute(e3); - if (!handleExtension(context, fault, e3, e2)) { - // ignore the extensiblity attribute - // TODO throw a WARNING - } + handleExtension(context, fault, e3, e2); } // verify that there is at most one child element and it is a documentation element @@ -780,7 +748,6 @@ } /* Here we check for the use scenario */ - Iterator itere2 = XmlUtil.getAllChildren(e2); context.push(); context.registerNamespaces(e2); BindingInput input = new BindingInput(forest.locatorTable.getStartLocation(e2)); @@ -984,8 +951,9 @@ errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); } gotDocumentation = true; - if(service.getDocumentation() == null) + if (service.getDocumentation() == null) { service.setDocumentation(getDocumentationFor(e2)); + } } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PORT)) { Port port = parsePort(context, definitions, e2); service.add(port); @@ -1022,16 +990,18 @@ for (Iterator iter = XmlUtil.getAllChildren(e); iter.hasNext();) { Element e2 = Util.nextElement(iter); - if (e2 == null) + if (e2 == null) { break; + } if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_DOCUMENTATION)) { if (gotDocumentation) { errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ONLY_ONE_DOCUMENTATION_ALLOWED(e.getLocalName())); } gotDocumentation = true; - if(port.getDocumentation() == null) + if (port.getDocumentation() == null) { port.setDocumentation(getDocumentationFor(e2)); + } } else { // possible extensibility element -- must live outside the WSDL namespace checkNotWsdlElement(e2); @@ -1049,8 +1019,9 @@ private void validateSchemaImports(Element typesElement){ for (Iterator iter = XmlUtil.getAllChildren(typesElement); iter.hasNext();) { Element e = Util.nextElement(iter); - if (e == null) + if (e == null) { break; + } if (XmlUtil.matchesTagNS(e, SchemaConstants.QNAME_IMPORT)) { errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.WARNING_WSI_R_2003()); }else{ @@ -1072,6 +1043,7 @@ (TWSDLExtensionHandler) extensionHandlers.get(e.getNamespaceURI()); if (h == null) { context.fireIgnoringExtension(e, (Entity) entity); + errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(e.getLocalName(), e.getNamespaceURI())); return false; } else { return h.doHandleExtension(context, entity, e); @@ -1087,6 +1059,7 @@ (TWSDLExtensionHandler) extensionHandlers.get(n.getNamespaceURI()); if (h == null) { context.fireIgnoringExtension(e, (Entity) entity); + errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_UNKNOWN_EXTENSIBILITY_ELEMENT_OR_ATTRIBUTE(n.getLocalName(), n.getNamespaceURI())); return false; } else { return h.doHandleExtension(context, entity, e); @@ -1095,15 +1068,17 @@ private void checkNotWsdlElement(Element e) { // possible extensibility element -- must live outside the WSDL namespace - if (e.getNamespaceURI() != null && e.getNamespaceURI().equals(Constants.NS_WSDL)) + if (e.getNamespaceURI() != null && e.getNamespaceURI().equals(Constants.NS_WSDL)) { errReceiver.error(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_INVALID_WSDL_ELEMENT(e.getTagName())); } + } private void checkNotWsdlAttribute(Attr a) { // possible extensibility element -- must live outside the WSDL namespace - if (a.getNamespaceURI().equals(Constants.NS_WSDL)) + if (Constants.NS_WSDL.equals(a.getNamespaceURI())) { errReceiver.error(forest.locatorTable.getStartLocation(a.getOwnerElement()), WsdlMessages.PARSING_INVALID_WSDL_ELEMENT(a.getLocalName())); } + } private void checkNotWsdlRequired(Element e) { // check the wsdl:required attribute, fail if set to "true"