Mon, 04 May 2009 21:10:41 -0700
6658158: Mutable statics in SAAJ (findbugs)
6658163: txw2.DatatypeWriter.BUILDIN is a mutable static (findbugs)
Reviewed-by: darcy
1 /*
2 * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 /*
26 *
27 */
31 /**
32 *
33 * @author SAAJ RI Development Team
34 */
35 package com.sun.xml.internal.messaging.saaj.soap.ver1_2;
37 import java.util.logging.Level;
38 import java.util.logging.Logger;
40 import javax.xml.soap.SOAPConstants;
41 import javax.xml.soap.SOAPException;
42 import javax.xml.transform.Source;
44 import com.sun.xml.internal.messaging.saaj.soap.*;
45 import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
46 import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser;
48 public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{
50 protected static final Logger log =
51 Logger.getLogger(SOAPPart1_2Impl.class.getName(),
52 "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
54 public SOAPPart1_2Impl() {
55 super();
56 }
58 public SOAPPart1_2Impl(MessageImpl message) {
59 super(message);
60 }
62 protected String getContentType() {
63 return "application/soap+xml";
64 }
66 protected Envelope createEmptyEnvelope(String prefix) throws SOAPException {
67 return new Envelope1_2Impl(getDocument(), prefix, true, true);
68 }
70 protected Envelope createEnvelopeFromSource() throws SOAPException {
71 XMLDeclarationParser parser = lookForXmlDecl();
72 Source tmp = source;
73 source = null;
74 EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this);
75 if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) {
76 log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2");
77 throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message");
78 }
80 if (!omitXmlDecl) {
81 envelope.setOmitXmlDecl("no");
82 envelope.setXmlDecl(parser.getXmlDeclaration());
83 envelope.setCharsetEncoding(parser.getEncoding());
84 }
85 return envelope;
87 }
89 protected SOAPPartImpl duplicateType() {
90 return new SOAPPart1_2Impl();
91 }
93 }