src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java

changeset 1460
c946a5cc042f
parent 1341
e5cc521294d8
child 1435
a90b319bae7a
     1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Tue Jan 03 08:52:15 2017 -0800
     1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java	Thu Jan 12 00:25:07 2017 +0300
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2017, 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 @@ -127,8 +127,11 @@
    1.11      }
    1.12  
    1.13      public SOAPElement addChildElement(String localName) throws SOAPException {
    1.14 -        return (SOAPElement) addChildElement(
    1.15 -            NameImpl.createFromUnqualifiedName(localName));
    1.16 +        String nsUri = getNamespaceURI("");
    1.17 +        Name name = (nsUri == null || nsUri.isEmpty())
    1.18 +                ?  NameImpl.createFromUnqualifiedName(localName)
    1.19 +                :  NameImpl.createFromQualifiedName(localName, nsUri);
    1.20 +        return addChildElement(name);
    1.21      }
    1.22  
    1.23      public SOAPElement addChildElement(String localName, String prefix)
    1.24 @@ -372,13 +375,13 @@
    1.25      protected SOAPElement addElement(Name name) throws SOAPException {
    1.26          SOAPElement newElement = createElement(name);
    1.27          addNode(newElement);
    1.28 -        return circumventBug5034339(newElement);
    1.29 +        return newElement;
    1.30      }
    1.31  
    1.32      protected SOAPElement addElement(QName name) throws SOAPException {
    1.33          SOAPElement newElement = createElement(name);
    1.34          addNode(newElement);
    1.35 -        return circumventBug5034339(newElement);
    1.36 +        return newElement;
    1.37      }
    1.38  
    1.39      protected SOAPElement createElement(Name name) {
    1.40 @@ -1201,26 +1204,6 @@
    1.41          return !"".equals(name.getNamespaceURI());
    1.42      }
    1.43  
    1.44 -    protected SOAPElement circumventBug5034339(SOAPElement element) {
    1.45 -
    1.46 -        Name elementName = element.getElementName();
    1.47 -        if (!isNamespaceQualified(elementName)) {
    1.48 -            String prefix = elementName.getPrefix();
    1.49 -            String defaultNamespace = getNamespaceURI(prefix);
    1.50 -            if (defaultNamespace != null) {
    1.51 -                Name newElementName =
    1.52 -                    NameImpl.create(
    1.53 -                        elementName.getLocalName(),
    1.54 -                        elementName.getPrefix(),
    1.55 -                        defaultNamespace);
    1.56 -                SOAPElement newElement = createElement(newElementName);
    1.57 -                replaceChild(newElement, element);
    1.58 -                return newElement;
    1.59 -            }
    1.60 -        }
    1.61 -        return element;
    1.62 -    }
    1.63 -
    1.64      //TODO: This is a temporary SAAJ workaround for optimizing XWS
    1.65      // should be removed once the corresponding JAXP bug is fixed
    1.66      // It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe)

mercurial