src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/ver1_2/Fault1_2Impl.java

Print this page
rev 447 : 8029237: Update copyright year to match last edit in jdk8 jaxws repository (2013)
Summary: Fixing Copyrights for year 2013
Reviewed-by: chegar
rev 472 : 8036030: Update JAX-WS RI integration to latest version
   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 267         throws SOAPException {
 268 
 269         // Fault Reason has similar semantics as faultstring
 270         Iterator eachTextElement =
 271             this.faultStringElement.getChildElements(textName);
 272         while (eachTextElement.hasNext()) {
 273             SOAPElement textElement = (SOAPElement) eachTextElement.next();
 274             Locale thisLocale = getLocale(textElement);
 275             if (thisLocale == null) {
 276                 log.severe("SAAJ0431.ver1_2.xml.lang.missing");
 277                 throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
 278             }
 279             if (thisLocale.equals(locale)) {
 280                 return textElement;
 281             }
 282         }
 283         return null;
 284     }
 285 
 286     public String getFaultNode() {
 287         SOAPElement faultNode = findChild(getFaultNodeName());
 288         if (faultNode == null) {
 289             return null;
 290         }
 291         return faultNode.getValue();
 292     }
 293 
 294     public void setFaultNode(String uri) throws SOAPException {
 295         SOAPElement faultNode = findChild(getFaultNodeName());
 296         if (faultNode != null) {
 297             faultNode.detachNode();
 298         }
 299         faultNode = createSOAPFaultElement(getFaultNodeName());
 300         faultNode = faultNode.addTextNode(uri);
 301         if (getFaultRole() != null) {
 302             insertBefore(faultNode, this.faultActorElement);
 303             return;
 304         }
 305         if (hasDetail()) {
 306             insertBefore(faultNode, this.detail);
 307             return;
 308         }
 309         addNode(faultNode);
 310     }
 311 
 312     public String getFaultRole() {
 313         return getFaultActor();
 314     }
 315 


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 267         throws SOAPException {
 268 
 269         // Fault Reason has similar semantics as faultstring
 270         Iterator eachTextElement =
 271             this.faultStringElement.getChildElements(textName);
 272         while (eachTextElement.hasNext()) {
 273             SOAPElement textElement = (SOAPElement) eachTextElement.next();
 274             Locale thisLocale = getLocale(textElement);
 275             if (thisLocale == null) {
 276                 log.severe("SAAJ0431.ver1_2.xml.lang.missing");
 277                 throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
 278             }
 279             if (thisLocale.equals(locale)) {
 280                 return textElement;
 281             }
 282         }
 283         return null;
 284     }
 285 
 286     public String getFaultNode() {
 287         SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
 288         if (faultNode == null) {
 289             return null;
 290         }
 291         return faultNode.getValue();
 292     }
 293 
 294     public void setFaultNode(String uri) throws SOAPException {
 295         SOAPElement faultNode = findAndConvertChildElement(getFaultNodeName());
 296         if (faultNode != null) {
 297             faultNode.detachNode();
 298         }
 299         faultNode = createSOAPFaultElement(getFaultNodeName());
 300         faultNode = faultNode.addTextNode(uri);
 301         if (getFaultRole() != null) {
 302             insertBefore(faultNode, this.faultActorElement);
 303             return;
 304         }
 305         if (hasDetail()) {
 306             insertBefore(faultNode, this.detail);
 307             return;
 308         }
 309         addNode(faultNode);
 310     }
 311 
 312     public String getFaultRole() {
 313         return getFaultActor();
 314     }
 315