This commit is contained in:
Lana Steuck 2017-02-16 18:28:43 +00:00
commit 34c09a281b
196 changed files with 5041 additions and 2026 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -54,9 +54,7 @@ public interface Localizable {
public Object[] getArguments();
public String getResourceBundleName();
public default ResourceBundle getResourceBundle(Locale locale) {
return null;
}
public ResourceBundle getResourceBundle(Locale locale);
/**
* Special constant that represents a message that

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -31,6 +31,7 @@ import java.util.Arrays;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* @author WS Development Team
*/
@ -42,13 +43,9 @@ public final class LocalizableMessage implements Localizable {
private final String _key;
private final Object[] _args;
@Deprecated
public LocalizableMessage(String bundlename, String key, Object... args) {
_bundlename = bundlename;
_rbSupplier = null;
_key = key;
if(args==null)
args = new Object[0];
_args = args;
this(bundlename, null, key, args);
}
public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier,
@ -61,15 +58,17 @@ public final class LocalizableMessage implements Localizable {
_args = args;
}
@Override
public String getKey() {
return _key;
}
@Override
public Object[] getArguments() {
return Arrays.copyOf(_args, _args.length);
}
@Override
public String getResourceBundleName() {
return _bundlename;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -36,6 +36,7 @@ public class LocalizableMessageFactory {
private final String _bundlename;
private final ResourceBundleSupplier _rbSupplier;
@Deprecated
public LocalizableMessageFactory(String bundlename) {
_bundlename = bundlename;
_rbSupplier = null;
@ -58,4 +59,5 @@ public class LocalizableMessageFactory {
*/
ResourceBundle getResourceBundle(Locale locale);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -25,7 +25,6 @@
package com.sun.istack.internal.localization;
import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Locale;
@ -41,7 +40,7 @@ import java.util.ResourceBundle;
public class Localizer {
private final Locale _locale;
private final HashMap _resourceBundles;
private final HashMap<String, ResourceBundle> _resourceBundles;
public Localizer() {
this(Locale.getDefault());
@ -49,7 +48,7 @@ public class Localizer {
public Localizer(Locale l) {
_locale = l;
_resourceBundles = new HashMap();
_resourceBundles = new HashMap<>();
}
public Locale getLocale() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -25,6 +25,9 @@
package com.sun.istack.internal.localization;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* {@link Localizable} that wraps a non-localizable string.
*
@ -39,13 +42,20 @@ public final class NullLocalizable implements Localizable {
this.msg = msg;
}
@Override
public String getKey() {
return Localizable.NOT_LOCALIZABLE;
}
@Override
public Object[] getArguments() {
return new Object[]{msg};
}
@Override
public String getResourceBundleName() {
return "";
}
@Override
public ResourceBundle getResourceBundle(Locale locale) {
return null;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -533,4 +533,14 @@ public abstract class JAXBRIContext extends JAXBContext {
* @since 2.2.6
*/
public static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity";
/**
* If true and element namespace is not specified, namespace of parent element will be used.
* The default value is false.
*
* Boolean
* @since 2.3.0
*/
public static final String BACKUP_WITH_PARENT_NAMESPACE = "com.sun.xml.internal.bind.backupWithParentNamespace";
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -112,6 +112,8 @@ public class ContextFactory {
"is not active. Using JAXB's implementation");
}
Boolean backupWithParentNamespace = getPropertyValue(properties, JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE, Boolean.class);
RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class);
Collection<TypeReference> tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class);
@ -144,6 +146,7 @@ public class ContextFactory {
builder.setSupressAccessorWarnings(supressAccessorWarnings);
builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling);
builder.setDisableSecurityProcessing(disablesecurityProcessing);
builder.setBackupWithParentNamespace(backupWithParentNamespace);
return builder.build();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -24,22 +24,6 @@
*/
/**
*
* @author SAAJ RI Development Team
*/
package com.sun.xml.internal.messaging.saaj.soap;
import com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl;
import com.sun.org.apache.xerces.internal.dom.DocumentFragmentImpl;
public class SOAPDocumentFragment extends DocumentFragmentImpl {
public SOAPDocumentFragment(CoreDocumentImpl ownerDoc) {
super(ownerDoc);
}
public SOAPDocumentFragment() {
super();
}
}
* Code that deals with low level byte code manipulation.
*/
package com.sun.xml.internal.bind.v2.bytecode;

View File

@ -1,32 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<body>
Code that deals with low level byte code manipulation.
</body>
</html>

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Abstraction around reading annotations, to support internal/external annotations.
*/
package com.sun.xml.internal.bind.v2.model.annotation;

View File

@ -1,30 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html><body>
Abstraction around reading annotations, to support internal/external annotations.
</body></html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -29,24 +29,25 @@ import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException;
/**
* listen to static errors found during building a JAXB model from a set of classes.
* Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
* Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
*
* <p>
* All the static errors have to be reported while constructing a
* model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder#link} completes.
* Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder} wraps an {@link ErrorHandler} and all the model
* model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} completes.
* Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} wraps an {@link ErrorHandler} and all the model
* components should report errors through it.
*
* <p>
* {@link IllegalAnnotationException} is a checked exception to remind
* the model classes to report it rather than to throw it.
*
* @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilder
* @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI
* @author Kohsuke Kawaguchi
*/
public interface ErrorHandler {
/**
* Receives a notification for an error in the annotated code.
* @param e
*/
void error( IllegalAnnotationException e );
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -57,7 +57,7 @@ public enum PropertyKind {
public final boolean isOrdered;
/**
* {@link com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
* {@code com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to
* {@link #ELEMENT}, {@link #REFERENCE}, and {@link #MAP} in this order.
*/
public final int propertyIndex;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -34,18 +34,22 @@ import javax.xml.bind.annotation.XmlRegistry;
*
* <p>
* This interface is only meant to be used as a return type from
* {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilder}.
* {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}.
*
* @author Kohsuke Kawaguchi
* @param <T>
* @param <C>
*/
public interface RegistryInfo<T,C> {
/**
* Returns all the references to other types in this registry.
* @return
*/
Set<TypeInfo<T,C>> getReferences();
/**
* Returns the class with {@link XmlRegistry}.
* @return
*/
C getClazz();
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Implementation of the com.sun.xml.internal.bind.j2s.model package.
*/
package com.sun.xml.internal.bind.v2.model.impl;

View File

@ -1,32 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<body>
Implementation of the com.sun.xml.internal.bind.j2s.model package.
</body>
</html>

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
*/
package com.sun.xml.internal.bind.v2.model.nav;

View File

@ -1,30 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html><body>
Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing).
</body></html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -241,6 +241,16 @@ public final class JAXBContextImpl extends JAXBRIContext {
private Set<XmlNs> xmlNsSet = null;
/**
* If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified.
* The default value is null for System {code}com.sun.xml.internal.bind.backupWithParentNamespace{code} property to be used,
* and false is assumed if it's not set either.
*
* Boolean
* @since 2.3.0
*/
public Boolean backupWithParentNamespace = null;
/**
* Returns declared XmlNs annotations (from package-level annotation XmlSchema
*
@ -263,6 +273,7 @@ public final class JAXBContextImpl extends JAXBRIContext {
this.supressAccessorWarnings = builder.supressAccessorWarnings;
this.improvedXsiTypeHandling = builder.improvedXsiTypeHandling;
this.disableSecurityProcessing = builder.disableSecurityProcessing;
this.backupWithParentNamespace = builder.backupWithParentNamespace;
Collection<TypeReference> typeRefs = builder.typeRefs;
@ -1024,6 +1035,7 @@ public final class JAXBContextImpl extends JAXBRIContext {
private boolean allNillable;
private boolean improvedXsiTypeHandling = true;
private boolean disableSecurityProcessing = true;
private Boolean backupWithParentNamespace = null; // null for System property to be used
public JAXBContextBuilder() {};
@ -1039,6 +1051,7 @@ public final class JAXBContextImpl extends JAXBRIContext {
this.xmlAccessorFactorySupport = baseImpl.xmlAccessorFactorySupport;
this.allNillable = baseImpl.allNillable;
this.disableSecurityProcessing = baseImpl.disableSecurityProcessing;
this.backupWithParentNamespace = baseImpl.backupWithParentNamespace;
}
public JAXBContextBuilder setRetainPropertyInfo(boolean val) {
@ -1101,6 +1114,11 @@ public final class JAXBContextImpl extends JAXBRIContext {
return this;
}
public JAXBContextBuilder setBackupWithParentNamespace(Boolean backupWithParentNamespace) {
this.backupWithParentNamespace = backupWithParentNamespace;
return this;
}
public JAXBContextImpl build() throws JAXBException {
// fool-proof

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Code that implements JAXBContext, Unmarshaller, and Marshaller.
*/
package com.sun.xml.internal.bind.v2.runtime;

View File

@ -1,32 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<body>
Code that implements JAXBContext, Unmarshaller, and Marshaller.
</body>
</html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -39,7 +39,7 @@ class AccessorInjector {
private static final Logger logger = Util.getClassLogger();
protected static final boolean noOptimize = Runtime.version().major() >= 9 ||
protected static final boolean noOptimize =
Util.getSystemProperty(ClassTailor.class.getName()+".noOptimize")!=null;
static {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -40,6 +40,11 @@ import java.util.logging.Logger;
import com.sun.xml.internal.bind.Util;
import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
import java.lang.reflect.Field;
import java.security.CodeSource;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain;
/**
* A {@link ClassLoader} used to "inject" optimized accessor classes
@ -131,7 +136,7 @@ final class Injector {
/**
* Injected classes keyed by their names.
*/
private final Map<String, Class> classes = new HashMap<String, Class>();
private final Map<String, Class> classes = new HashMap<>();
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
private final Lock r = rwl.readLock();
private final Lock w = rwl.writeLock();
@ -141,26 +146,59 @@ final class Injector {
* False otherwise, which happens if this classloader can't see {@link Accessor}.
*/
private final boolean loadable;
private static final Method defineClass;
private static final Method resolveClass;
private static final Method findLoadedClass;
private static Method defineClass;
private static Method resolveClass;
private static Method findLoadedClass;
private static Object U;
static {
Method[] m = AccessController.doPrivileged(
new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
return new Method[]{
getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
getMethod(ClassLoader.class, "resolveClass", Class.class),
getMethod(ClassLoader.class, "findLoadedClass", String.class)
};
}
try {
Method[] m = AccessController.doPrivileged(
new PrivilegedAction<Method[]>() {
@Override
public Method[] run() {
return new Method[]{
getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE),
getMethod(ClassLoader.class, "resolveClass", Class.class),
getMethod(ClassLoader.class, "findLoadedClass", String.class)
};
}
);
defineClass = m[0];
resolveClass = m[1];
findLoadedClass = m[2];
}
);
defineClass = m[0];
resolveClass = m[1];
findLoadedClass = m[2];
} catch (Throwable t) {
try {
U = AccessController.doPrivileged(new PrivilegedExceptionAction() {
@Override
public Object run() throws Exception {
Class u = Class.forName("sun.misc.Unsafe");
Field theUnsafe = u.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
return theUnsafe.get(null);
}
});
defineClass = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@Override
public Method run() throws Exception {
try {
return U.getClass().getMethod("defineClass",
new Class[]{String.class,
byte[].class,
Integer.TYPE,
Integer.TYPE,
ClassLoader.class,
ProtectionDomain.class});
} catch (NoSuchMethodException | SecurityException ex) {
throw ex;
}
}
});
} catch (SecurityException | PrivilegedActionException ex) {
Logger.getLogger(Injector.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
private static Method getMethod(final Class<?> c, final String methodname, final Class<?>... params) {
@ -210,13 +248,11 @@ final class Injector {
rlocked = false;
//find loaded class from classloader
if (c == null) {
if (c == null && findLoadedClass != null) {
try {
c = (Class) findLoadedClass.invoke(parent, className.replace('/', '.'));
} catch (IllegalArgumentException e) {
logger.log(Level.FINE, "Unable to find " + className, e);
} catch (IllegalAccessException e) {
} catch (IllegalArgumentException | IllegalAccessException e) {
logger.log(Level.FINE, "Unable to find " + className, e);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
@ -253,9 +289,13 @@ final class Injector {
// we need to inject a class into the
try {
c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
resolveClass.invoke(parent, c);
} catch (IllegalAccessException e) {
if (resolveClass != null) {
c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length);
resolveClass.invoke(parent, c);
} else {
c = (Class) defineClass.invoke(U, className.replace('/', '.'), image, 0, image.length, parent, Injector.class.getProtectionDomain());
}
} catch (IllegalAccessException e) {
logger.log(Level.FINE, "Unable to inject " + className, e);
return null;
} catch (InvocationTargetException e) {

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Hosts optimized
* {@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor},
* {@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and {@link com.sun.xml.internal.bind.v2.runtime.Transducer}.
*
* <h2>How it works</h2>
* <p>
* Most of the classes in this package are "templates." At run-time, A template class file is slightly modified to match
* the target Java Bean, then it will be loaded into the VM.
*/
package com.sun.xml.internal.bind.v2.runtime.reflect.opt;

View File

@ -1,39 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html><body>
Hosts optimized
{@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor},
{@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and
{@link com.sun.xml.internal.bind.v2.runtime.Transducer}.
<h2>How it works</h2>
<p>
Most of the classes in this package are "templates." At run-time,
A template class file is slightly modified to match the target Java Bean,
then it will be loaded into the VM.
</body></html>

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Abstraction around accessing data of actual objects.
*/
package com.sun.xml.internal.bind.v2.runtime.reflect;

View File

@ -1,30 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html><body>
Abstraction around accessing data of actual objects.
</body></html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -33,7 +33,7 @@ import org.xml.sax.Locator;
import org.w3c.dom.Node;
/**
* Object that returns the current location that the {@link com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
* Object that returns the current location that the {@code com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor}
* is parsing.
*
* @author Kohsuke Kawaguchi
@ -41,6 +41,7 @@ import org.w3c.dom.Node;
public interface LocatorEx extends Locator {
/**
* Gets the current location in a {@link ValidationEventLocator} object.
* @return
*/
ValidationEventLocator getLocation();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -31,7 +31,9 @@ import java.util.Map;
import javax.xml.namespace.QName;
import com.sun.xml.internal.bind.Util;
import com.sun.xml.internal.bind.api.AccessorException;
import com.sun.xml.internal.bind.api.JAXBRIContext;
import com.sun.xml.internal.bind.v2.WellKnownNamespace;
import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl;
import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
@ -231,11 +233,26 @@ public final class StructureLoader extends Loader {
@Override
public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException {
ChildLoader child = childUnmarshallers.get(arg.uri,arg.local);
if (child == null) {
child = catchAll;
if (child==null) {
super.childElement(state,arg);
return;
if(child == null) {
Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace;
backupWithParentNamespace = backupWithParentNamespace != null
? backupWithParentNamespace
: Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE));
if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) {
Iterator<?> typeNamesIt = beanInfo.getTypeNames().iterator();
QName parentQName = null;
if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) {
parentQName = (QName) typeNamesIt.next();
String parentUri = parentQName.getNamespaceURI();
child = childUnmarshallers.get(parentUri, arg.local);
}
}
if (child == null) {
child = catchAll;
if(child==null) {
super.childElement(state,arg);
return;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -23,5 +23,8 @@
* questions.
*/
/**
* XML Schema writer generated by TXW.
*/
@com.sun.xml.internal.txw2.annotation.XmlNamespace("http://www.w3.org/2001/XMLSchema")
package com.sun.xml.internal.bind.v2.schemagen.xmlschema;

View File

@ -1,32 +0,0 @@
<!--
Copyright (c) 1997, 2012, 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
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the LICENSE file that accompanied this code.
This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).
You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.
-->
<html>
<body>
XML Schema writer generated by TXW.
</body>
</html>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, 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
@ -158,7 +158,7 @@ class ContextFinder {
Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
return newInstance(contextPath, spFactory, classLoader, properties);
} catch (ClassNotFoundException x) {
throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
} catch (RuntimeException | JAXBException x) {
// avoid wrapping RuntimeException to JAXBException,
@ -228,7 +228,7 @@ class ContextFinder {
}
}
private static Object instantiateProviderIfNecessary(Class<?> implClass) throws JAXBException {
private static Object instantiateProviderIfNecessary(final Class<?> implClass) throws JAXBException {
try {
if (JAXBContextFactory.class.isAssignableFrom(implClass)) {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@ -254,7 +254,7 @@ class ContextFinder {
try {
spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new JAXBException(e);
throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), e);
}
if (logger.isLoggable(Level.FINE)) {
@ -525,6 +525,7 @@ class ContextFinder {
} else {
return (ClassLoader) java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public java.lang.Object run() {
return Thread.currentThread().getContextClassLoader();
}
@ -539,6 +540,7 @@ class ContextFinder {
} else {
return (ClassLoader) java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public java.lang.Object run() {
return c.getClassLoader();
}
@ -552,6 +554,7 @@ class ContextFinder {
} else {
return (ClassLoader) java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
@Override
public java.lang.Object run() {
return ClassLoader.getSystemClassLoader();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, 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
@ -65,6 +65,9 @@ class Messages
static final String PROVIDER_NOT_FOUND = // 1 arg
"ContextFinder.ProviderNotFound";
static final String DEFAULT_PROVIDER_NOT_FOUND = // 0 args
"ContextFinder.DefaultProviderNotFound";
static final String COULD_NOT_INSTANTIATE = // 2 args
"ContextFinder.CouldNotInstantiate";

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2003, 2017, 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
@ -26,6 +26,9 @@
ContextFinder.ProviderNotFound = \
Provider {0} not found
ContextFinder.DefaultProviderNotFound = \
Implementation of JAXB-API has not been found on module path or classpath.
ContextFinder.CouldNotInstantiate = \
Provider {0} could not be instantiated: {1}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined
* sub-classes to allow arbitrary Java classes to be used with JAXB.
* <p>
* <h2>Package Specification</h2>
* <p>
* <ul>
* <li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB Specification</a>
* </ul>
* <p>
* <h2>Related Documentation</h2>
* <p>
* For overviews, tutorials, examples, guides, and tool documentation,
* please see:
* <ul>
* <li>The <a href="http://jaxb.java.net">JAXB Website</a>
* </ul>
*
* @see <a href="http://jaxb.java.net">JAXB Website</a>
*/
package javax.xml.bind.annotation.adapters;

View File

@ -0,0 +1,50 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* <B>JAXB Provider Use Only:</b> Provides partial default implementations for
* some of the <code>javax.xml.bind</code> interfaces.
* <p>
* <p>
* JAXB Providers can extend these classes and implement the abstract
* methods.
* <p>
* <h2>Package Specification</h2>
* <p>
* <ul>
* <li><a href="https://jaxb.java.net/">JAXB Specification</a>
* </ul>
* <p>
* <h2>Related Documentation</h2>
* <p>
* For overviews, tutorials, examples, guides, and tool documentation,
* please see:
* <ul>
* <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
* </ul>
*
* @see <a href="https://jaxb.java.net/">JAXB Website</a>
*/
package javax.xml.bind.helpers;

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Provides a runtime binding framework for client applications including
* unmarshalling, marshalling, and validation capabilities.
* <p>
* <p>
* <code>JAXBContext</code> is the client-entry point to the runtime binding
* framework.
* <p>
* <p>
* <h2>Package Specification</h2>
* <p>
* <ul>
* <li><a href="https://jaxb.java.net/">JAXB Specification</a>
* </ul>
* <p>
* <h2>Related Documentation</h2>
* <p>
* For overviews, tutorials, examples, guides, and tool documentation,
* please see:
* <ul>
* <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
* </ul>
*
* @see <a href="https://jaxb.java.net/">JAXB Website</a>
*/
package javax.xml.bind;

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Useful client utility classes.
* <p>
* <h2>Package Specification</h2>
* <p>
* <ul>
* <li><a href="https://jaxb.java.net/">JAXB Specification</a>
* </ul>
* <p>
* <h2>Related Documentation</h2>
* <p>
* For overviews, tutorials, examples, guides, and tool documentation,
* please see:
* <ul>
* <li>The <a href="https://jaxb.java.net/">JAXB Website</a>
* </ul>
*
* @see <a href="https://jaxb.java.net/">JAXB Website</a>
*/
package javax.xml.bind.util;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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
@ -34,6 +34,7 @@ module java.xml.bind {
requires java.compiler;
requires java.desktop;
requires java.logging;
requires jdk.unsupported;
uses javax.xml.bind.JAXBContextFactory;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, 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
@ -39,8 +39,7 @@ import javax.xml.stream.XMLStreamWriter;
public interface LazyEnvelopeSource extends javax.xml.transform.Source {
/**
* Retrieve payload qname without materializing its contents
* @return
* @throws SOAPException
* @return payload QName
*/
public QName getPayloadQName();
public XMLStreamReader readToBodyStarTag() throws XMLStreamException;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -86,6 +86,7 @@ public class SOAPExceptionImpl extends SOAPException {
/**
* Constructs a <code>SOAPExceptionImpl</code> object initialized
* with the given <code>Throwable</code> object.
* @param cause cause
*/
public SOAPExceptionImpl(Throwable cause) {
super (cause.toString());
@ -106,6 +107,7 @@ public class SOAPExceptionImpl extends SOAPException {
* message of the embedded <code>Throwable</code> object,
* if there is one
*/
@Override
public String getMessage() {
String message = super.getMessage ();
if (message == null && cause != null) {
@ -124,6 +126,7 @@ public class SOAPExceptionImpl extends SOAPException {
* if there is none
*/
@Override
public Throwable getCause() {
return cause;
}
@ -157,6 +160,7 @@ public class SOAPExceptionImpl extends SOAPException {
* method has already been called on this <code>SOAPExceptionImpl</code>
* object
*/
@Override
public synchronized Throwable initCause(Throwable cause)
{
if(this.cause != null) {
@ -170,6 +174,7 @@ public class SOAPExceptionImpl extends SOAPException {
return this;
}
@Override
public void printStackTrace() {
super.printStackTrace();
if (cause != null) {
@ -178,6 +183,7 @@ public class SOAPExceptionImpl extends SOAPException {
}
}
@Override
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
if (cause != null) {
@ -186,6 +192,7 @@ public class SOAPExceptionImpl extends SOAPException {
}
}
@Override
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
if (cause != null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -512,9 +512,13 @@ class HttpSOAPConnection extends SOAPConnection {
: httpConnection.getInputStream());
// If no reply message is returned,
// content-Length header field value is expected to be zero.
// InputStream#available() can't be used here - it just says no data *YET*!
// java SE 6 documentation says :
// available() : an estimate of the number of bytes that can be read
//(or skipped over) from this input stream without blocking
//or 0 when it reaches the end of the input stream.
if ((httpIn == null )
|| (httpConnection.getContentLength() == 0)) {
|| (httpConnection.getContentLength() == 0)
|| (httpIn.available() == 0)) {
response = null;
log.warning("SAAJ0014.p2p.content.zero");
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -69,7 +69,7 @@ public interface MultipartDataSource extends DataSource {
* @return the MimeBodyPart
* @exception IndexOutOfBoundsException if the given index
* is out of range.
* @exception MessagingException
* @exception MessagingException thrown in case of error
*/
public MimeBodyPart getBodyPart(int index) throws MessagingException;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -115,6 +115,8 @@ public class BMMimeMultipart extends MimeMultipart {
* <code>contentType</code> field. <p>
*
* MimeBodyParts may be added later.
*
* @param subtype subtype.
*/
public BMMimeMultipart(String subtype) {
super(subtype);
@ -142,7 +144,9 @@ public class BMMimeMultipart extends MimeMultipart {
* skips the 'preamble' and reads bytes till the terminating
* boundary and creates MimeBodyParts for each part of the stream.
*
* @param ds DataSource, can be a MultipartDataSource
* @param ds DataSource, can be a MultipartDataSource.
* @param ct content type.
* @exception MessagingException in case of error.
*/
public BMMimeMultipart(DataSource ds, ContentType ct)
throws MessagingException {
@ -197,6 +201,7 @@ public class BMMimeMultipart extends MimeMultipart {
*
* @since JavaMail 1.2
*/
@Override
protected void parse() throws MessagingException {
if (parsed)
return;
@ -694,6 +699,7 @@ public class BMMimeMultipart extends MimeMultipart {
* separated by a boundary.
*/
@Override
public void writeTo(OutputStream os)
throws IOException, MessagingException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -100,6 +100,7 @@ public class ContentDisposition {
/**
* Return the specified parameter value. Returns <code>null</code>
* if this parameter is absent.
* @param name parameter name.
* @return parameter value
* @since JavaMail 1.2
*/
@ -123,7 +124,7 @@ public class ContentDisposition {
/**
* Set the primary type. Overrides existing primary type.
* @param primaryType primary type
* @param disposition disposition value
* @since JavaMail 1.2
*/
public void setDisposition(String disposition) {
@ -162,6 +163,7 @@ public class ContentDisposition {
* @return RFC2045 style string
* @since JavaMail 1.2
*/
@Override
public String toString() {
if (disposition == null)
return null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -136,6 +136,7 @@ public final class ContentType {
/**
* Return the specified parameter value. Returns <code>null</code>
* if this parameter is absent.
* @param name parameter name
* @return parameter value
*/
public String getParameter(String name) {
@ -200,6 +201,7 @@ public final class ContentType {
*
* @return RFC2045 style string
*/
@Override
public String toString() {
if (primaryType == null || subType == null) // need both
return null;
@ -218,7 +220,7 @@ public final class ContentType {
/**
* Match with the specified ContentType object. This method
* compares <strong>only the <code>primaryType</code> and
* <code>subType</code> </strong>. The parameters of both operands
* <code>primaryType</code> </strong>. The parameters of both operands
* are ignored. <p>
*
* For example, this method will return <code>true</code> when
@ -232,6 +234,8 @@ public final class ContentType {
* and <strong>"text/*" </strong>
*
* @param cType to compare this against
* @return true if <code>primaryType</code> and <code>subType</code>
* match specified content type.
*/
public boolean match(ContentType cType) {
// Match primaryType
@ -266,6 +270,10 @@ public final class ContentType {
* For example, this method will return <code>true</code> when
* comparing the ContentType for <strong>"text/plain"</strong>
* with <strong>"text/*" </strong>
*
* @param s content type
* @return true if <code>primaryType</code> and <code>subType</code>
* match specified content type.
*/
public boolean match(String s) {
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -95,14 +95,15 @@ public class HeaderTokenizer {
* one of the following:
* <ul>
* <li><code>ATOM</code> A sequence of ASCII characters
* delimited by either SPACE, CTL, "(", <"> or the
* specified SPECIALS
* delimited by either SPACE, CTL, "(", &lt;"&gt; or the
* specified SPECIALS</li>
* <li><code>QUOTEDSTRING</code> A sequence of ASCII characters
* within quotes
* within quotes</li>
* <li><code>COMMENT</code> A sequence of ASCII characters
* within "(" and ")".
* <li><code>EOF</code> End of header
* within "(" and ")".</li>
* <li><code>EOF</code> End of header</li>
* </ul>
* @return type
*/
public int getType() {
return type;
@ -176,6 +177,7 @@ public class HeaderTokenizer {
* Constructor. The RFC822 defined delimiters - RFC822 - are
* used to delimit ATOMS. Also comments are skipped and not
* returned as tokens
* @param header The header that is tokenized.
*/
public HeaderTokenizer(String header) {
this(header, RFC822);
@ -317,7 +319,7 @@ public class HeaderTokenizer {
currentPos++; // re-position currentPos
char ch[] = new char[1];
ch[0] = c;
return new Token((int)c, new String(ch));
return new Token(c, new String(ch));
}
// Check for ATOM

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -48,13 +48,12 @@ import java.util.NoSuchElementException;
* until the blank line that indicates end of header. The input stream
* is positioned at the start of the body. The lines are stored
* within the object and can be extracted as either Strings or
* {@link Header} objects. <p>
* <p/>
* {@link Header} objects.
* <p>
* This class is mostly intended for service providers. MimeMessage
* and MimeBody use this class for holding their headers. <p>
* <p/>
* <hr> <strong>A note on RFC822 and MIME headers</strong><p>
* <p/>
* and MimeBody use this class for holding their headers.
* <hr> <strong>A note on RFC822 and MIME headers</strong>
* <p>
* RFC822 and MIME header fields <strong>must</strong> contain only
* US-ASCII characters. If a header contains non US-ASCII characters,
* it must be encoded as per the rules in RFC 2047. The MimeUtility
@ -65,7 +64,7 @@ import java.util.NoSuchElementException;
* header fields must be folded (wrapped) before being sent if they
* exceed the line length limitation for the transport (1000 bytes for
* SMTP). Received headers may have been folded. The application is
* responsible for folding and unfolding headers as appropriate. <p>
* responsible for folding and unfolding headers as appropriate.
*
* @author John Mani
* @author Bill Shannon
@ -90,12 +89,13 @@ public final class InternetHeaders {
* Read and parse the given RFC822 message stream till the
* blank line separating the header from the body. The input
* stream is left positioned at the start of the body. The
* header lines are stored internally. <p>
* <p/>
* header lines are stored internally.
* <p>
* For efficiency, wrap a BufferedInputStream around the actual
* input stream and pass it as the parameter.
*
* @param is RFC822 input stream
* @exception MessagingException in case of error
*/
public InternetHeaders(InputStream is) throws MessagingException {
load(is);
@ -104,13 +104,14 @@ public final class InternetHeaders {
/**
* Read and parse the given RFC822 message stream till the
* blank line separating the header from the body. Store the
* header lines inside this InternetHeaders object. <p>
* <p/>
* header lines inside this InternetHeaders object.
* <p>
* Note that the header lines are added into this InternetHeaders
* object, so any existing headers in this object will not be
* affected.
*
* @param is RFC822 input stream
* @exception MessagingException in case of error
*/
public void load(InputStream is) throws MessagingException {
// Read header lines until a blank line. It is valid
@ -208,9 +209,9 @@ public final class InternetHeaders {
/**
* Change the first header line that matches name
* to have value, adding a new header if no existing header
* matches. Remove all matching headers but the first. <p>
* <p/>
* Note that RFC822 headers can only contain US-ASCII characters
* matches. Remove all matching headers but the first.
* <p>
* Note that RFC822 headers can only contain US-ASCII characters.
*
* @param name header name
* @param value header value
@ -242,8 +243,7 @@ public final class InternetHeaders {
}
/**
* Add a header with the specified name and value to the header list. <p>
* <p/>
* Add a header with the specified name and value to the header list.
* Note that RFC822 headers can only contain US-ASCII characters.
*
* @param name header name
@ -285,15 +285,15 @@ public final class InternetHeaders {
*
* @return Header objects
*/
public List<? extends Header> getAllHeaders() {
public FinalArrayList<hdr> getAllHeaders() {
return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here
}
/**
* Add an RFC822 header line to the header store.
* If the line starts with a space or tab (a continuation line),
* add it to the last header line in the list. <p>
* <p/>
* add it to the last header line in the list.
* <p>
* Note that RFC822 headers can only contain US-ASCII characters
*
* @param line raw RFC822 header line
@ -316,15 +316,19 @@ public final class InternetHeaders {
/**
* Return all the header lines as a collection
*
* @return list of header lines.
*/
public List<String> getAllHeaderLines() {
if(headerValueView==null)
headerValueView = new AbstractList<String>() {
public String get(int index) {
@Override
public String get(int index) {
return headers.get(index).line;
}
public int size() {
@Override
public int size() {
return headers.size();
}
};
@ -368,6 +372,7 @@ class hdr implements Header {
/*
* Return the "name" part of the header line.
*/
@Override
public String getName() {
return name;
}
@ -375,6 +380,7 @@ class hdr implements Header {
/*
* Return the "value" part of the header line.
*/
@Override
public String getValue() {
int i = line.indexOf(':');
if (i < 0)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -32,7 +32,6 @@
package com.sun.xml.internal.messaging.saaj.packaging.mime.internet;
import com.sun.xml.internal.messaging.saaj.packaging.mime.Header;
import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
import com.sun.xml.internal.messaging.saaj.packaging.mime.util.OutputUtil;
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
@ -52,12 +51,12 @@ import com.sun.xml.internal.org.jvnet.mimepull.MIMEPart;
/**
* This class represents a MIME body part.
* MimeBodyParts are contained in <code>MimeMultipart</code>
* objects. <p>
*
* objects.
* <p>
* MimeBodyPart uses the <code>InternetHeaders</code> class to parse
* and store the headers of that body part. <p>
* and store the headers of that body part.
*
* <hr><strong>A note on RFC 822 and MIME headers</strong><p>
* <hr><strong>A note on RFC 822 and MIME headers</strong>
*
* RFC 822 header fields <strong>must</strong> contain only
* US-ASCII characters. MIME allows non ASCII characters to be present
@ -70,7 +69,7 @@ import com.sun.xml.internal.org.jvnet.mimepull.MIMEPart;
* header fields must be folded (wrapped) before being sent if they
* exceed the line length limitation for the transport (1000 bytes for
* SMTP). Received headers may have been folded. The application is
* responsible for folding and unfolding headers as appropriate. <p>
* responsible for folding and unfolding headers as appropriate.
*
* @author John Mani
* @author Bill Shannon
@ -179,6 +178,8 @@ public final class MimeBodyPart {
* the delimiter strings.
*
* @param is the body part Input Stream
*
* @exception MessagingException in case of error
*/
public MimeBodyPart(InputStream is) throws MessagingException {
if (!(is instanceof ByteArrayInputStream) &&
@ -216,6 +217,7 @@ public final class MimeBodyPart {
*
* @param headers The header of this part
* @param content bytes representing the body of this part.
* @param len content length.
*/
public MimeBodyPart(InternetHeaders headers, byte[] content, int len) {
this.headers = headers;
@ -242,6 +244,7 @@ public final class MimeBodyPart {
/**
* Return the containing <code>MimeMultipart</code> object,
* or <code>null</code> if not known.
* @return parent part.
*/
public MimeMultipart getParent() {
return parent;
@ -253,6 +256,7 @@ public final class MimeBodyPart {
* <code>addBodyPart</code> method. <code>parent</code> may be
* <code>null</code> if the <code>MimeBodyPart</code> is being removed
* from its containing <code>MimeMultipart</code>.
* @param parent parent part
* @since JavaMail 1.1
*/
public void setParent(MimeMultipart parent) {
@ -351,6 +355,9 @@ public final class MimeBodyPart {
* If the <code>subType</code> of <code>mimeType</code> is the
* special character '*', then the subtype is ignored during the
* comparison.
*
* @param mimeType string
* @return true if it is valid mime type
*/
public boolean isMimeType(String mimeType) {
boolean result;
@ -375,6 +382,9 @@ public final class MimeBodyPart {
* This implementation uses <code>getHeader(name)</code>
* to obtain the requisite header field.
*
* @return content disposition
* @exception MessagingException in case of error
*
* @see #headers
*/
public String getDisposition() throws MessagingException {
@ -392,6 +402,9 @@ public final class MimeBodyPart {
* If the disposition is null, any existing "Content-Disposition"
* header field is removed.
*
* @param disposition value
*
* @exception MessagingException in case of error
* @exception IllegalStateException if this body part is
* obtained from a READ_ONLY folder.
*/
@ -423,6 +436,9 @@ public final class MimeBodyPart {
* This implementation uses <code>getHeader(name)</code>
* to obtain the requisite header field.
*
* @return encoding
* @exception MessagingException in case of error
*
* @see #headers
*/
public String getEncoding() throws MessagingException {
@ -465,6 +481,8 @@ public final class MimeBodyPart {
*
* This implementation uses <code>getHeader(name)</code>
* to obtain the requisite header field.
*
* @return conent id
*/
public String getContentID() {
return getHeader("Content-ID", null);
@ -475,6 +493,7 @@ public final class MimeBodyPart {
* If the <code>cid</code> parameter is null, any existing
* "Content-ID" is removed.
*
* @param cid content id
* @exception IllegalStateException if this body part is
* obtained from a READ_ONLY folder.
* @since JavaMail 1.3
@ -493,6 +512,8 @@ public final class MimeBodyPart {
*
* This implementation uses <code>getHeader(name)</code>
* to obtain the requisite header field.
*
* @return content MD5 sum
*/
public String getContentMD5() {
return getHeader("Content-MD5", null);
@ -501,6 +522,8 @@ public final class MimeBodyPart {
/**
* Set the "Content-MD5" header field of this body part.
*
* @param md5 content md5 sum
*
* @exception IllegalStateException if this body part is
* obtained from a READ_ONLY folder.
*/
@ -516,6 +539,9 @@ public final class MimeBodyPart {
*
* This implementation uses <code>getHeader(name)</code>
* to obtain the requisite header field.
*
* @return array of language tags
* @exception MessagingException in case of error
*/
public String[] getContentLanguage() throws MessagingException {
String s = getHeader("Content-Language", null);
@ -663,6 +689,7 @@ public final class MimeBodyPart {
* Returns <code>null</code> if both are absent.
*
* @return filename
* @exception MessagingException in case of error
*/
public String getFileName() throws MessagingException {
String filename = null;
@ -692,6 +719,9 @@ public final class MimeBodyPart {
* Sets the "filename" parameter of the "Content-Disposition"
* header field of this body part.
*
* @param filename filename
*
* @exception MessagingException in case of error
* @exception IllegalStateException if this body part is
* obtained from a READ_ONLY folder.
*/
@ -769,9 +799,14 @@ public final class MimeBodyPart {
* This implementation simply calls the <code>getContentStream</code>
* method.
*
* @return input stream
*
* @exception MessagingException in case of error
*
* @see #getInputStream
* @see #getContentStream
* @since JavaMail 1.2
*
*/
public InputStream getRawInputStream() throws MessagingException {
return getContentStream();
@ -782,24 +817,30 @@ public final class MimeBodyPart {
*
* The implementation provided here works just like the
* the implementation in MimeMessage.
*
* @return data handler
*/
public DataHandler getDataHandler() {
if (mimePart != null) {
//return an inputstream
return new DataHandler(new DataSource() {
@Override
public InputStream getInputStream() throws IOException {
return mimePart.read();
}
@Override
public OutputStream getOutputStream() throws IOException {
throw new UnsupportedOperationException("getOutputStream cannot be supported : You have enabled LazyAttachments Option");
}
@Override
public String getContentType() {
return mimePart.getContentType();
}
@Override
public String getName() {
return "MIMEPart Wrapped DataSource";
}
@ -890,6 +931,8 @@ public final class MimeBodyPart {
* If the charset is already known, use the
* setText() version that takes the charset parameter.
*
* @param text string
*
* @see #setText(String text, String charset)
*/
public void setText(String text) {
@ -902,6 +945,9 @@ public final class MimeBodyPart {
* charset. The given Unicode string will be charset-encoded
* using the specified charset. The charset is also used to set
* the "charset" parameter.
*
* @param text string
* @param charset character set
*/
public void setText(String text, String charset) {
if (charset == null) {
@ -932,7 +978,9 @@ public final class MimeBodyPart {
/**
* Output the body part as an RFC 822 format stream.
*
* @exception MessagingException
* @param os output stream
*
* @exception MessagingException in case of error
* @exception IOException if an error occurs writing to the
* stream or if an error is generated
* by the javax.activation layer.
@ -1033,6 +1081,8 @@ public final class MimeBodyPart {
/**
* Remove all headers with this name.
*
* @param name header name
*/
public void removeHeader(String name) {
headers.removeHeader(name);
@ -1041,14 +1091,18 @@ public final class MimeBodyPart {
/**
* Return all the headers from this Message as an Enumeration of
* Header objects.
*
* @return all headers
*/
public List<? extends Header> getAllHeaders() {
public FinalArrayList<hdr> getAllHeaders() {
return headers.getAllHeaders();
}
/**
* Add a header line to this body part
*
* @param line header line to add
*/
public void addHeaderLine(String line) {
headers.addHeaderLine(line);
@ -1075,6 +1129,8 @@ public final class MimeBodyPart {
* <br>
* In both cases this method is typically called by the
* <code>Message.saveChanges</code> method.
*
* @exception MessagingException in case of error.
*/
protected void updateHeaders() throws MessagingException {
DataHandler dh = getDataHandler();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -133,6 +133,7 @@ public class MimeMultipart {
* <code>contentType</code> field. <p>
*
* MimeBodyParts may be added later.
* @param subtype subtype.
*/
public MimeMultipart(String subtype) {
//super();
@ -163,6 +164,8 @@ public class MimeMultipart {
* This must be the same information as {@link DataSource#getContentType()}.
* All the callers of this method seem to have this object handy, so
* for performance reason this method accepts it. Can be null.
*
* @exception MessagingException in case of error
*/
public MimeMultipart(DataSource ds, ContentType ct) throws MessagingException {
// 'ds' was not a MultipartDataSource, we have
@ -189,7 +192,8 @@ public class MimeMultipart {
/**
* Return the number of enclosed MimeBodyPart objects.
*
* @return number of parts
* @return number of parts.
* @throws MessagingException in case of error.
*/
public int getCount() throws MessagingException {
parse();
@ -202,8 +206,8 @@ public class MimeMultipart {
/**
* Get the specified MimeBodyPart. BodyParts are numbered starting at 0.
*
* @param index the index of the desired MimeBodyPart
* @return the MimeBodyPart
* @param index the index of the desired MimeBodyPart.
* @return the MimeBodyPart.
* @exception MessagingException if no such MimeBodyPart exists
*/
public MimeBodyPart getBodyPart(int index)
@ -221,6 +225,7 @@ public class MimeMultipart {
*
* @param CID the ContentID of the desired part
* @return the MimeBodyPart
* @exception MessagingException if no such MimeBodyPart exists.
*/
public MimeBodyPart getBodyPart(String CID)
throws MessagingException {
@ -256,6 +261,8 @@ public class MimeMultipart {
* expensive for a specific MimeMultipart subclass, then it
* might itself want to track whether its internal state actually
* did change, and do the header updating only if necessary.
*
* @exception MessagingException in case of error.
*/
protected void updateHeaders() throws MessagingException {
for (int i = 0; i < parts.size(); i++)
@ -265,6 +272,11 @@ public class MimeMultipart {
/**
* Iterates through all the parts and outputs each Mime part
* separated by a boundary.
*
* @param os output stream.
*
* @exception IOException if an I/O Error occurs.
* @exception MessagingException in case of error.
*/
public void writeTo(OutputStream os)
throws IOException, MessagingException {
@ -291,6 +303,8 @@ public class MimeMultipart {
* method is called by all other methods that need data for
* the body parts, to make sure the data has been parsed.
*
* @exception MessagingException in case of error.
*
* @since JavaMail 1.2
*/
protected void parse() throws MessagingException {
@ -490,8 +504,9 @@ public class MimeMultipart {
* necessary. This implementation simply constructs and returns
* an InternetHeaders object.
*
* @param is the InputStream to read the headers from
* @exception MessagingException
* @param is the InputStream to read the headers from.
* @return headers.
* @exception MessagingException in case of error.
* @since JavaMail 1.2
*/
protected InternetHeaders createInternetHeaders(InputStream is)
@ -506,8 +521,10 @@ public class MimeMultipart {
* necessary. This implementation simply constructs and returns
* a MimeBodyPart object.
*
* @param headers the headers for the body part
* @param content the content of the body part
* @param headers the headers for the body part.
* @param content the content of the body part.
* @param len the content length.
* @return MimeBodyPart
* @since JavaMail 1.2
*/
protected MimeBodyPart createMimeBodyPart(InternetHeaders headers, byte[] content, int len) {
@ -521,8 +538,9 @@ public class MimeMultipart {
* necessary. This implementation simply constructs and returns
* a MimeBodyPart object.
*
* @param is InputStream containing the body part
* @exception MessagingException
* @param is InputStream containing the body part.
* @return MimeBodyPart.
* @exception MessagingException in case of error.
* @since JavaMail 1.2
*/
protected MimeBodyPart createMimeBodyPart(InputStream is) throws MessagingException {
@ -543,8 +561,8 @@ public class MimeMultipart {
* a specific multipart subtype.
*
* @param mp MimeMultipart datasource
* @exception MessagingException in case of error.
*/
protected void setMultipartDataSource(MultipartDataSource mp)
throws MessagingException {
contentType = new ContentType(mp.getContentType());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -50,6 +50,8 @@ public final class MimePartDataSource implements DataSource {
/**
* Constructor, that constructs a DataSource from a MimeBodyPart.
*
* @param part body part
*/
public MimePartDataSource(MimeBodyPart part) {
this.part = part;
@ -68,6 +70,7 @@ public final class MimePartDataSource implements DataSource {
*
* @return decoded input stream
*/
@Override
public InputStream getInputStream() throws IOException {
try {
@ -88,7 +91,8 @@ public final class MimePartDataSource implements DataSource {
*
* This implementation throws the UnknownServiceException.
*/
public OutputStream getOutputStream() throws IOException {
@Override
public OutputStream getOutputStream() throws IOException {
throw new UnknownServiceException();
}
@ -98,6 +102,7 @@ public final class MimePartDataSource implements DataSource {
* This implementation just invokes the <code>getContentType</code>
* method on the MimeBodyPart.
*/
@Override
public String getContentType() {
return part.getContentType();
}
@ -107,7 +112,8 @@ public final class MimePartDataSource implements DataSource {
*
* This implementation just returns an empty string.
*/
public String getName() {
@Override
public String getName() {
try {
return part.getFileName();
} catch (MessagingException mex) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -65,11 +65,11 @@ import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
* <p>
* Note that to get the actual bytes of a mail-safe String (say,
* for sending over SMTP), one must do
* <p><blockquote><pre>
* <blockquote><pre>
*
* byte[] bytes = string.getBytes("iso-8859-1");
*
* </pre></blockquote><p>
* </pre></blockquote>
*
* The <code>setHeader</code> and <code>addHeader</code> methods
* on MimeMessage and MimeBodyPart assume that the given header values
@ -222,6 +222,10 @@ public class MimeUtility {
* <code>DataHandler</code> uses a thread, a pair of pipe streams,
* and the <code>writeTo</code> method to produce the data. <p>
*
* @param dh data handler
*
* @return encoding
*
* @since JavaMail 1.2
*/
public static String getEncoding(DataHandler dh) {
@ -294,6 +298,7 @@ public class MimeUtility {
* @param is input stream
* @param encoding the encoding of the stream.
* @return decoded input stream.
* @exception MessagingException in case of error
*/
public static InputStream decode(InputStream is, String encoding)
throws MessagingException {
@ -323,6 +328,7 @@ public class MimeUtility {
* @param encoding the encoding of the stream.
* @return output stream that applies the
* specified encoding.
* @exception MessagingException in case of error
*/
public static OutputStream encode(OutputStream os, String encoding)
throws MessagingException {
@ -358,6 +364,7 @@ public class MimeUtility {
* with uuencode)
* @return output stream that applies the
* specified encoding.
* @exception MessagingException in case of error
* @since JavaMail 1.2
*/
public static OutputStream encode(OutputStream os, String encoding,
@ -397,7 +404,7 @@ public class MimeUtility {
* "unstructured" RFC 822 headers. <p>
*
* Example of usage:
* <p><blockquote><pre>
* <blockquote><pre>
*
* MimeBodyPart part = ...
* String rawvalue = "FooBar Mailer, Japanese version 1.1"
@ -411,7 +418,7 @@ public class MimeUtility {
* // setHeader() failure
* }
*
* </pre></blockquote><p>
* </pre></blockquote>
*
* @param text unicode string
* @return Unicode string containing only US-ASCII characters
@ -446,6 +453,7 @@ public class MimeUtility {
* encoded are in the ASCII charset, otherwise "B" encoding
* is used.
* @return Unicode string containing only US-ASCII characters
* @exception UnsupportedEncodingException in case of unsupported encoding
*/
public static String encodeText(String text, String charset,
String encoding)
@ -464,7 +472,7 @@ public class MimeUtility {
* returned as-is <p>
*
* Example of usage:
* <p><blockquote><pre>
* <blockquote><pre>
*
* MimeBodyPart part = ...
* String rawvalue = null;
@ -479,9 +487,10 @@ public class MimeUtility {
*
* return value;
*
* </pre></blockquote><p>
* </pre></blockquote>
*
* @param etext the possibly encoded value
* @return decoded text
* @exception UnsupportedEncodingException if the charset
* conversion failed.
*/
@ -568,7 +577,7 @@ public class MimeUtility {
* The InternetAddress class, for example, uses this to encode
* it's 'phrase' component.
*
* @param text unicode string
* @param word unicode string
* @return Array of Unicode strings containing only US-ASCII
* characters.
* @exception UnsupportedEncodingException if the encoding fails
@ -590,7 +599,7 @@ public class MimeUtility {
* The resulting bytes are then returned as a Unicode string
* containing only ASCII characters. <p>
*
* @param text unicode string
* @param word unicode string
* @param charset the MIME charset
* @param encoding the encoding to be used. Currently supported
* values are "B" and "Q". If this parameter is null, then
@ -720,6 +729,7 @@ public class MimeUtility {
* fails, an UnsupportedEncodingException is thrown.<p>
*
* @param eword the possibly encoded value
* @return deocoded word
* @exception ParseException if the string is not an
* encoded-word as per RFC 2047.
* @exception UnsupportedEncodingException if the charset
@ -847,8 +857,8 @@ public class MimeUtility {
* @param word word to be quoted
* @param specials the set of special characters
* @return the possibly quoted word
* @see javax.mail.internet.HeaderTokenizer#MIME
* @see javax.mail.internet.HeaderTokenizer#RFC822
* @see com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer#MIME
* @see com.sun.xml.internal.messaging.saaj.packaging.mime.internet.HeaderTokenizer#RFC822
*/
public static String quote(String word, String specials) {
int len = word.length();
@ -1111,7 +1121,8 @@ public class MimeUtility {
} catch (SecurityException sex) {
class NullInputStream extends InputStream {
public int read() {
@Override
public int read() {
return 0;
}
}
@ -1277,7 +1288,7 @@ public class MimeUtility {
int l = s.length();
for (int i = 0; i < l; i++) {
if (nonascii((int)s.charAt(i))) // non-ascii
if (nonascii(s.charAt(i))) // non-ascii
non_ascii++;
else
ascii++;
@ -1444,14 +1455,17 @@ class AsciiOutputStream extends OutputStream {
checkEOL = encodeEolStrict && breakOnNonAscii;
}
@Override
public void write(int b) throws IOException {
check(b);
}
@Override
public void write(byte b[]) throws IOException {
write(b, 0, b.length);
}
@Override
public void write(byte b[], int off, int len) throws IOException {
len += off;
for (int i = off; i < len ; i++)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -73,6 +73,9 @@ public interface SharedInputStream {
/**
* Writes the specified region to another {@link OutputStream}.
* @param start the starting position
* @param end the ending position + 1
* @param out output stream
*/
public void writeTo(long start,long end, OutputStream out);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -43,9 +43,17 @@ public class ASCIIUtility {
/**
* Convert the bytes within the specified range of the given byte
* array into a signed integer in the given radix . The range extends
* from <code>start</code> till, but not including <code>end</code>. <p>
* from <code>start</code> till, but not including <code>end</code>.
*
* Based on java.lang.Integer.parseInt().
*
* @param b bytes to convert to integer.
* @param start start of the range.
* @param end end of the range (not including).
* @param radix radix.
*
* @return integer.
*
* Based on java.lang.Integer.parseInt()
*/
public static int parseInt(byte[] b, int start, int end, int radix)
throws NumberFormatException {
@ -110,7 +118,14 @@ public class ASCIIUtility {
/**
* Convert the bytes within the specified range of the given byte
* array into a String. The range extends from <code>start</code>
* till, but not including <code>end</code>. <p>
* till, but not including <code>end</code>.
*
* @param b bytes to convert to integer.
* @param start start of the range.
* @param end end of the range (not including).
*
* @return integer.
*
*/
public static String toString(byte[] b, int start, int end) {
int size = end - start;
@ -122,6 +137,15 @@ public class ASCIIUtility {
return new String(theChars);
}
/**
* Encodes specified String into a sequence of bytes using the platform's
* default charset, storing the result into a new byte array.
*
* @param s string to encode into byte array.
*
* @return byte array.
*
*/
public static byte[] getBytes(String s) {
char [] chars= s.toCharArray();
int size = chars.length;
@ -133,6 +157,13 @@ public class ASCIIUtility {
}
/**
* Converts input stream to array.
*
* @param is stream to convert to array.
*
* @return byte array.
*
* @throws IOException if an I/O error occurs.
*
* @deprecated
* this is an expensive operation that require an additional
@ -140,6 +171,7 @@ public class ASCIIUtility {
* Unless you absolutely need the exact size array, don't use this.
* Use {@link ByteOutputStream} and {@link ByteOutputStream#write(InputStream)}.
*/
@Deprecated
public static byte[] getBytes(InputStream is) throws IOException {
ByteOutputStream bos = null;
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -70,6 +70,7 @@ public class BASE64DecoderStream extends FilterInputStream {
* @exception IOException if an I/O error occurs.
* @see java.io.FilterInputStream#in
*/
@Override
public int read() throws IOException {
if (index >= bufsize) {
decode(); // Fills up buffer
@ -94,6 +95,7 @@ public class BASE64DecoderStream extends FilterInputStream {
* the stream has been reached.
* @exception IOException if an I/O error occurs.
*/
@Override
public int read(byte[] buf, int off, int len) throws IOException {
int i, c;
for (i = 0; i < len; i++) {
@ -112,6 +114,7 @@ public class BASE64DecoderStream extends FilterInputStream {
* Tests if this input stream supports marks. Currently this class
* does not support marks
*/
@Override
public boolean markSupported() {
return false; // Maybe later ..
}
@ -122,6 +125,7 @@ public class BASE64DecoderStream extends FilterInputStream {
* a close approximation in case the original encoded stream
* contains embedded CRLFs; since the CRLFs are discarded, not decoded
*/
@Override
public int available() throws IOException {
// This is only an estimate, since in.available()
// might include CRLFs too ..
@ -200,6 +204,10 @@ public class BASE64DecoderStream extends FilterInputStream {
* in the IMAP AUTHENTICATE protocol, but not to decode the
* entire content of a MIME part.
*
* @param inbuf byte array to decode
*
* @return decoded byte array
*
* NOTE: inbuf may only contain valid base64 characters.
* Whitespace is not ignored.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -80,6 +80,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* @param len the number of bytes to write.
* @exception IOException if an I/O error occurs.
*/
@Override
public void write(byte[] b, int off, int len) throws IOException {
for (int i = 0; i < len; i++)
write(b[off + i]);
@ -90,6 +91,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* @param b the data to be written.
* @exception IOException if an I/O error occurs.
*/
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@ -99,6 +101,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* @param c the <code>byte</code>.
* @exception IOException if an I/O error occurs.
*/
@Override
public void write(int c) throws IOException {
buffer[bufsize++] = (byte)c;
if (bufsize == 3) { // Encoding unit = 3 bytes
@ -112,6 +115,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* to be encoded out to the stream.
* @exception IOException if an I/O error occurs.
*/
@Override
public void flush() throws IOException {
if (bufsize > 0) { // If there's unencoded characters in the buffer ..
encode(); // .. encode them
@ -124,6 +128,7 @@ public class BASE64EncoderStream extends FilterOutputStream {
* Forces any buffered output bytes to be encoded out to the stream
* and closes this output stream
*/
@Override
public void close() throws IOException {
flush();
out.close();
@ -186,6 +191,10 @@ public class BASE64EncoderStream extends FilterOutputStream {
* This method is suitable for short strings, such as those
* in the IMAP AUTHENTICATE protocol, but not to encode the
* entire content of a MIME part.
*
* @param inbuf byte array to encode.
*
* @return encoded byte array.
*/
public static byte[] encode(byte[] inbuf) {
if (inbuf.length == 0)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -55,6 +55,10 @@ public class BEncoderStream extends BASE64EncoderStream {
/**
* Returns the length of the encoded version of this byte array.
*
* @param b byte array.
*
* @return length of the byte array.
*/
public static int encodedLength(byte[] b) {
return ((b.length + 2)/3) * 4;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -64,6 +64,10 @@ public final class LineInputStream extends FilterInputStream {
*
* This class is similar to the deprecated
* <code>DataInputStream.readLine()</code>
*
* @return line.
*
* @throws IOException if an I/O error occurs.
*/
public String readLine() throws IOException {
InputStream in = this.in;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -54,6 +54,11 @@ public abstract class OutputUtil {
/**
* Writes a string as ASCII string.
*
* @param s string.
* @param out output stream.
*
* @throws IOException if an I/O error occurs.
*/
public static void writeAsAscii(String s,OutputStream out) throws IOException {
int len = s.length();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -69,6 +69,7 @@ public class QEncoderStream extends QPEncoderStream {
* @param c the <code>byte</code>.
* @exception IOException if an I/O error occurs.
*/
@Override
public void write(int c) throws IOException {
c = c & 0xff; // Turn off the MSB.
if (c == ' ')
@ -82,6 +83,11 @@ public class QEncoderStream extends QPEncoderStream {
/**
* Returns the length of the encoded version of this byte array.
*
* @param b byte array.
* @param encodingWord whether use word or text specials.
*
* @return length.
*/
public static int encodedLength(byte[] b, boolean encodingWord) {
int len = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -83,23 +83,29 @@ public class UUEncoderStream extends FilterOutputStream {
/**
* Set up the buffer name and permission mode.
* This method has any effect only if it is invoked before
* you start writing into the output stream
* you start writing into the output stream.
*
* @param name name to set for the buffer.
* @param mode permission mode.
*/
public void setNameMode(String name, int mode) {
this.name = name;
this.mode = mode;
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
for (int i = 0; i < len; i++)
write(b[off + i]);
}
@Override
public void write(byte[] data) throws IOException {
write(data, 0, data.length);
}
public void write(int c) throws IOException {
@Override
public void write(int c) throws IOException {
/* buffer up characters till we get a line's worth, then encode
* and write them out. Max number of characters allowed per
* line is 45.
@ -112,6 +118,7 @@ public class UUEncoderStream extends FilterOutputStream {
}
}
@Override
public void flush() throws IOException {
if (bufsize > 0) { // If there's unencoded characters in the buffer
writePrefix();
@ -121,6 +128,7 @@ public class UUEncoderStream extends FilterOutputStream {
out.flush();
}
@Override
public void close() throws IOException {
flush();
out.close();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -41,16 +41,25 @@ import javax.xml.transform.Source;
public interface Envelope extends SOAPEnvelope {
/**
* Get the content as a JAXP Source.
*
* @return source
*/
Source getContent();
/**
* Output the content.
*
* @param out output stream.
* @exception IOException in case of an I/O error.
*/
void output(OutputStream out) throws IOException;
/**
* Output the content.
*
* @param out output stream
* @param isFastInfoset true if it is fast infoset.
* @exception IOException in case of an I/O error.
*/
void output(OutputStream out, boolean isFastInfoset) throws IOException;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -47,9 +47,10 @@ public class FastInfosetDataContentHandler implements DataContentHandler {
}
/**
* return the DataFlavors for this <code>DataContentHandler</code>
* Return the DataFlavors for this <code>DataContentHandler</code>
* @return The DataFlavors.
*/
@Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
DataFlavor flavors[] = new DataFlavor[1];
flavors[0] = new ActivationDataFlavor(
@ -59,11 +60,13 @@ public class FastInfosetDataContentHandler implements DataContentHandler {
}
/**
* return the Transfer Data of type DataFlavor from InputStream
* @param df The DataFlavor.
* @param ins The InputStream corresponding to the data.
* Return the Transfer Data of type DataFlavor from InputStream
* @param flavor The DataFlavor.
* @param dataSource DataSource.
* @return The constructed Object.
* @exception IOException in case of an I/O error
*/
@Override
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
throws IOException
{
@ -81,6 +84,7 @@ public class FastInfosetDataContentHandler implements DataContentHandler {
return null;
}
@Override
public Object getContent(DataSource dataSource) throws IOException {
try {
return FastInfosetReflection.FastInfosetSource_new(
@ -92,10 +96,11 @@ public class FastInfosetDataContentHandler implements DataContentHandler {
}
/**
* construct an object from a byte stream
* Construct an object from a byte stream
* (similar semantically to previous method, we are deciding
* which one to support)
*/
@Override
public void writeTo(Object obj, String mimeType, OutputStream os)
throws IOException
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -52,6 +52,7 @@ public class GifDataContentHandler extends Component implements DataContentHandl
*
* @return The DataFlavors
*/
@Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
return new DataFlavor[] { getDF()};
}
@ -60,9 +61,11 @@ public class GifDataContentHandler extends Component implements DataContentHandl
* Return the Transfer Data of type DataFlavor from InputStream.
*
* @param df The DataFlavor
* @param ins The InputStream corresponding to the data
* @param ds The DataSource
* @return String object
* @exception IOException in case of an I/O error
*/
@Override
public Object getTransferData(DataFlavor df, DataSource ds)
throws IOException {
// use myDF.equals to be sure to get ActivationDataFlavor.equals,
@ -73,6 +76,7 @@ public class GifDataContentHandler extends Component implements DataContentHandl
return null;
}
@Override
public Object getContent(DataSource ds) throws IOException {
InputStream is = ds.getInputStream();
int pos = 0;
@ -98,7 +102,11 @@ public class GifDataContentHandler extends Component implements DataContentHandl
/**
* Write the object to the output stream, using the specified MIME type.
* @param obj object to write
* @param type requested MIME type of the resulting byte stream
* @param os OutputStream
*/
@Override
public void writeTo(Object obj, String type, OutputStream os)
throws IOException {
if (obj != null && !(obj instanceof Image))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -67,8 +67,9 @@ public class ImageDataContentHandler extends Component
*
* @return The DataFlavors.
*/
@Override
public DataFlavor[] getTransferDataFlavors() {
return (DataFlavor[]) Arrays.copyOf(flavor, flavor.length);
return Arrays.copyOf(flavor, flavor.length);
}
/**
@ -80,6 +81,7 @@ public class ImageDataContentHandler extends Component
* @param ds The DataSource representing the data to be converted.
* @return The constructed Object.
*/
@Override
public Object getTransferData(DataFlavor df, DataSource ds)
throws IOException {
for (int i=0; i < flavor.length; i++) {
@ -98,6 +100,7 @@ public class ImageDataContentHandler extends Component
* @param ds The DataSource representing the data to be converted.
* @return The constructed Object.
*/
@Override
public Object getContent(DataSource ds) throws IOException {
return ImageIO.read(new BufferedInputStream(ds.getInputStream()));
}
@ -107,11 +110,11 @@ public class ImageDataContentHandler extends Component
* and write it to the output stream.
*
* @param obj The object to be converted.
* @param mimeType The requested MIME type of the resulting byte stream.
* @param type The requested MIME type of the resulting byte stream.
* @param os The output stream into which to write the converted
* byte stream.
*/
@Override
public void writeTo(Object obj, String type, OutputStream os)
throws IOException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -47,9 +47,10 @@ public class JpegDataContentHandler
public static final String STR_SRC = "java.awt.Image";
/**
* return the DataFlavors for this <code>DataContentHandler</code>
* Return the DataFlavors for this <code>DataContentHandler</code>
* @return The DataFlavors.
*/
@Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
DataFlavor flavors[] = new DataFlavor[1];
@ -67,11 +68,12 @@ public class JpegDataContentHandler
}
/**
* return the Transfer Data of type DataFlavor from InputStream
* @param df The DataFlavor.
* @param ins The InputStream corresponding to the data.
* Return the Transfer Data of type DataFlavor from InputStream
* @param df The DataFlavor
* @param ds The DataSource
* @return The constructed Object.
*/
@Override
public Object getTransferData(DataFlavor df, DataSource ds) {
// this is sort of hacky, but will work for the
@ -98,6 +100,7 @@ public class JpegDataContentHandler
/**
*
*/
@Override
public Object getContent(DataSource ds) { // throws Exception;
InputStream inputStream = null;
BufferedImage jpegLoadImage = null;
@ -109,14 +112,18 @@ public class JpegDataContentHandler
} catch (Exception e) {
}
return (Image) jpegLoadImage;
return jpegLoadImage;
}
/**
* construct an object from a byte stream
* Construct an object from a byte stream
* (similar semantically to previous method, we are deciding
* which one to support)
* @param obj object to write
* @param mimeType requested MIME type of the resulting byte stream
* @param os OutputStream
*/
@Override
public void writeTo(Object obj, String mimeType, OutputStream os)
throws IOException {
if (!mimeType.equals("image/jpeg"))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, 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
@ -38,24 +38,24 @@ public interface LazyEnvelope extends Envelope {
/**
* Retrieve payload qname without materializing its contents
* @return
* @throws SOAPException
* @return QName
* @throws SOAPException in case of an error
*/
public QName getPayloadQName() throws SOAPException;
/**
* Retrieve payload attribute value without materializing its contents
* @param localName
* @return
* @throws SOAPException
* @param localName local name
* @return payload attribute value
* @throws SOAPException in case of an error
*/
public String getPayloadAttributeValue(String localName) throws SOAPException;
/**
* Retrieve payload attribute value without materializing its contents
* @param qName
* @return
* @throws SOAPException
* @param qName QName
* @return payload attribute value
* @throws SOAPException in case of an error
*/
public String getPayloadAttributeValue(QName qName) throws SOAPException;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -95,7 +95,7 @@ public abstract class MessageImpl
/**
* True if this part is encoded using Fast Infoset.
* MIME -> application/fastinfoset
* MIME -&gt; application/fastinfoset
*/
protected boolean isFastInfoset = false;
@ -202,6 +202,9 @@ public abstract class MessageImpl
/**
* Construct a new message. This will be invoked before message
* sends.
*
* @param isFastInfoset whether it is fast infoset
* @param acceptFastInfoset whether to accept fast infoset
*/
protected MessageImpl(boolean isFastInfoset, boolean acceptFastInfoset) {
this.isFastInfoset = isFastInfoset;
@ -214,6 +217,8 @@ public abstract class MessageImpl
/**
* Shallow copy.
*
* @param msg SoapMessage
*/
protected MessageImpl(SOAPMessage msg) {
if (!(msg instanceof MessageImpl)) {
@ -233,14 +238,17 @@ public abstract class MessageImpl
/**
* @param stat
* the mask value obtained from {@link #identifyContentType(ContentType)}
* @return true if SOAP 1.1 Content
*/
protected static boolean isSoap1_1Content(int stat) {
return (stat & SOAP1_1_FLAG) != 0;
}
/**
* Check whether it is SOAP 1.2 content.
* @param stat
* the mask value obtained from {@link #identifyContentType(ContentType)}
* @return true if it is SOAP 1.2 content
*/
protected static boolean isSoap1_2Content(int stat) {
return (stat & SOAP1_2_FLAG) != 0;
@ -298,6 +306,9 @@ public abstract class MessageImpl
* Construct a message from an input stream. When messages are
* received, there's two parts -- the transport headers and the
* message content in a transport specific stream.
* @param headers MimeHeaders
* @param in InputStream
* @exception SOAPExceptionImpl in case of I/O error
*/
protected MessageImpl(MimeHeaders headers, final InputStream in)
throws SOAPExceptionImpl {
@ -332,6 +343,7 @@ public abstract class MessageImpl
* received, there's two parts -- the transport headers and the
* message content in a transport specific stream.
*
* @param headers headers
* @param contentType
* The parsed content type header from the headers variable.
* This is redundant parameter, but it avoids reparsing this header again.
@ -339,6 +351,8 @@ public abstract class MessageImpl
* The result of {@link #identifyContentType(ContentType)} over
* the contentType parameter. This redundant parameter, but it avoids
* recomputing this information again.
* @param in input stream
* @exception SOAPExceptionImpl in case of an error
*/
protected MessageImpl(MimeHeaders headers, final ContentType contentType, int stat, final InputStream in) throws SOAPExceptionImpl {
init(headers, stat, contentType, in);
@ -425,18 +439,22 @@ public abstract class MessageImpl
} else if ((stat & MIME_MULTIPART_FLAG) != 0) {
final InputStream finalIn = in;
DataSource ds = new DataSource() {
@Override
public InputStream getInputStream() {
return finalIn;
}
@Override
public OutputStream getOutputStream() {
return null;
}
@Override
public String getContentType() {
return contentType.toString();
}
@Override
public String getName() {
return "";
}
@ -591,10 +609,12 @@ public abstract class MessageImpl
return Boolean.valueOf(lazyParsingProp.toString());
}
}
@Override
public Object getProperty(String property) {
return (String) properties.get(property);
return properties.get(property);
}
@Override
public void setProperty(String property, Object value) {
verify(property, value);
properties.put(property, value);
@ -722,6 +742,7 @@ public abstract class MessageImpl
return "text/xml";
}
@Override
public MimeHeaders getMimeHeaders() {
return this.headers;
}
@ -805,10 +826,12 @@ public abstract class MessageImpl
saved = false;
}
@Override
public boolean saveRequired() {
return saved != true;
}
@Override
public String getContentDescription() {
String[] values = headers.getHeader("Content-Description");
if (values != null && values.length > 0)
@ -816,13 +839,16 @@ public abstract class MessageImpl
return null;
}
@Override
public void setContentDescription(String description) {
headers.setHeader("Content-Description", description);
needsSave();
}
@Override
public abstract SOAPPart getSOAPPart();
@Override
public void removeAllAttachments() {
try {
initializeAllAttachments();
@ -836,6 +862,7 @@ public abstract class MessageImpl
}
}
@Override
public int countAttachments() {
try {
initializeAllAttachments();
@ -847,6 +874,7 @@ public abstract class MessageImpl
return 0;
}
@Override
public void addAttachmentPart(AttachmentPart attachment) {
try {
initializeAllAttachments();
@ -864,6 +892,7 @@ public abstract class MessageImpl
static private final Iterator nullIter = Collections.EMPTY_LIST.iterator();
@Override
public Iterator getAttachments() {
try {
initializeAllAttachments();
@ -897,12 +926,14 @@ public abstract class MessageImpl
private MimeHeaders headers;
private AttachmentPart nextAttachment;
@Override
public boolean hasNext() {
if (nextAttachment == null)
nextAttachment = nextMatch();
return nextAttachment != null;
}
@Override
public AttachmentPart next() {
if (nextAttachment != null) {
AttachmentPart ret = nextAttachment;
@ -925,11 +956,13 @@ public abstract class MessageImpl
return null;
}
@Override
public void remove() {
iter.remove();
}
}
@Override
public Iterator getAttachments(MimeHeaders headers) {
try {
initializeAllAttachments();
@ -942,6 +975,7 @@ public abstract class MessageImpl
return new MimeMatchingIterator(headers);
}
@Override
public void removeAttachments(MimeHeaders headers) {
try {
initializeAllAttachments();
@ -966,10 +1000,12 @@ public abstract class MessageImpl
// needsSave();
}
@Override
public AttachmentPart createAttachmentPart() {
return new AttachmentPartImpl();
}
@Override
public AttachmentPart getAttachment(SOAPElement element)
throws SOAPException {
try {
@ -1187,6 +1223,7 @@ public abstract class MessageImpl
}
}
@Override
public void saveChanges() throws SOAPException {
// suck in all the data from the attachments and have it
@ -1340,6 +1377,7 @@ public abstract class MessageImpl
}
@Override
public void writeTo(OutputStream out) throws SOAPException, IOException {
if (saveRequired()){
this.optimizeAttachmentProcessing = true;
@ -1397,6 +1435,7 @@ public abstract class MessageImpl
needsSave();
}
@Override
public SOAPBody getSOAPBody() throws SOAPException {
SOAPBody body = getSOAPPart().getEnvelope().getBody();
/*if (body == null) {
@ -1405,6 +1444,7 @@ public abstract class MessageImpl
return body;
}
@Override
public SOAPHeader getSOAPHeader() throws SOAPException {
SOAPHeader hdr = getSOAPPart().getEnvelope().getHeader();
/*if (hdr == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -43,6 +43,7 @@ public class MultipartDataContentHandler implements DataContentHandler {
*
* @return The DataFlavors
*/
@Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
return new DataFlavor[] { myDF };
}
@ -51,9 +52,10 @@ public class MultipartDataContentHandler implements DataContentHandler {
* Return the Transfer Data of type DataFlavor from InputStream.
*
* @param df The DataFlavor
* @param ins The InputStream corresponding to the data
* @param ds The DataSource
* @return String object
*/
@Override
public Object getTransferData(DataFlavor df, DataSource ds) {
// use myDF.equals to be sure to get ActivationDataFlavor.equals,
// which properly ignores Content-Type parameters in comparison
@ -65,7 +67,11 @@ public class MultipartDataContentHandler implements DataContentHandler {
/**
* Return the content.
*
* @param ds The DataSource
* @return content
*/
@Override
public Object getContent(DataSource ds) {
try {
return new MimeMultipart(
@ -78,6 +84,7 @@ public class MultipartDataContentHandler implements DataContentHandler {
/**
* Write the object to the output stream, using the specific MIME type.
*/
@Override
public void writeTo(Object obj, String mimeType, OutputStream os)
throws IOException {
if (obj instanceof MimeMultipart) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -29,16 +29,42 @@
*/
package com.sun.xml.internal.messaging.saaj.soap;
import java.util.logging.Logger;
import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
import org.w3c.dom.*;
import com.sun.xml.internal.messaging.saaj.soap.impl.*;
import com.sun.xml.internal.messaging.saaj.soap.impl.CDATAImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.ElementFactory;
import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPCommentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.SOAPTextImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.EntityReference;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.UserDataHandler;
public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
public class SOAPDocumentImpl implements SOAPDocument, javax.xml.soap.Node, Document {
private static final String XMLNS = "xmlns".intern();
protected static final Logger log =
@ -47,8 +73,24 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
SOAPPartImpl enclosingSOAPPart;
private Document document;
private Map<Node, javax.xml.soap.Node> domToSoap = new HashMap<>();
public SOAPDocumentImpl(SOAPPartImpl enclosingDocument) {
document = createDocument();
this.enclosingSOAPPart = enclosingDocument;
register(this);
}
private Document createDocument() {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
try {
final DocumentBuilder documentBuilder = docFactory.newDocumentBuilder();
return documentBuilder.newDocument();
} catch (ParserConfigurationException e) {
throw new RuntimeException("Error creating xml document", e);
}
}
// public SOAPDocumentImpl(boolean grammarAccess) {
@ -81,7 +123,7 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
}
public DOMImplementation getImplementation() {
return super.getImplementation();
return document.getImplementation();
}
public Element getDocumentElement() {
@ -91,7 +133,7 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
}
protected Element doGetDocumentElement() {
return super.getDocumentElement();
return document.getDocumentElement();
}
public Element createElement(String tagName) throws DOMException {
@ -103,7 +145,7 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
}
public DocumentFragment createDocumentFragment() {
return new SOAPDocumentFragment(this);
return document.createDocumentFragment();
}
public org.w3c.dom.Text createTextNode(String data) {
@ -139,7 +181,7 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
}
}
return super.createAttribute(name);
return document.createAttribute(name);
}
public EntityReference createEntityReference(String name)
@ -149,12 +191,15 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
}
public NodeList getElementsByTagName(String tagname) {
return super.getElementsByTagName(tagname);
return document.getElementsByTagName(tagname);
}
public org.w3c.dom.Node importNode(Node importedNode, boolean deep)
throws DOMException {
return super.importNode(importedNode, deep);
final Node node = document.importNode(getDomNode(importedNode), deep);
return node instanceof Element ?
ElementFactory.createElement(this, (Element) node)
: node;
}
public Element createElementNS(String namespaceURI, String qualifiedName)
@ -168,26 +213,386 @@ public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
throws DOMException {
return super.createAttributeNS(namespaceURI, qualifiedName);
return document.createAttributeNS(namespaceURI, qualifiedName);
}
public NodeList getElementsByTagNameNS(
String namespaceURI,
String localName) {
return super.getElementsByTagNameNS(namespaceURI, localName);
return document.getElementsByTagNameNS(namespaceURI, localName);
}
public Element getElementById(String elementId) {
return super.getElementById(elementId);
return document.getElementById(elementId);
}
@Override
public String getInputEncoding() {
return document.getInputEncoding();
}
@Override
public String getXmlEncoding() {
return document.getXmlEncoding();
}
@Override
public boolean getXmlStandalone() {
return document.getXmlStandalone();
}
@Override
public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
document.setXmlStandalone(xmlStandalone);
}
@Override
public String getXmlVersion() {
return document.getXmlVersion();
}
@Override
public void setXmlVersion(String xmlVersion) throws DOMException {
document.setXmlVersion(xmlVersion);
}
@Override
public boolean getStrictErrorChecking() {
return document.getStrictErrorChecking();
}
@Override
public void setStrictErrorChecking(boolean strictErrorChecking) {
document.setStrictErrorChecking(strictErrorChecking);
}
@Override
public String getDocumentURI() {
return document.getDocumentURI();
}
@Override
public void setDocumentURI(String documentURI) {
document.setDocumentURI(documentURI);
}
@Override
public Node adoptNode(Node source) throws DOMException {
return document.adoptNode(source);
}
@Override
public DOMConfiguration getDomConfig() {
return document.getDomConfig();
}
@Override
public void normalizeDocument() {
document.normalizeDocument();
}
@Override
public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException {
return document.renameNode(n, namespaceURI, qualifiedName);
}
@Override
public String getNodeName() {
return document.getNodeName();
}
@Override
public String getNodeValue() throws DOMException {
return document.getNodeValue();
}
@Override
public void setNodeValue(String nodeValue) throws DOMException {
document.setNodeValue(nodeValue);
}
@Override
public short getNodeType() {
return document.getNodeType();
}
@Override
public Node getParentNode() {
return document.getParentNode();
}
@Override
public NodeList getChildNodes() {
return document.getChildNodes();
}
@Override
public Node getFirstChild() {
return document.getFirstChild();
}
@Override
public Node getLastChild() {
return document.getLastChild();
}
@Override
public Node getPreviousSibling() {
return document.getPreviousSibling();
}
@Override
public Node getNextSibling() {
return document.getNextSibling();
}
@Override
public NamedNodeMap getAttributes() {
return document.getAttributes();
}
@Override
public Document getOwnerDocument() {
return document.getOwnerDocument();
}
@Override
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
return document.insertBefore(getDomNode(newChild), getDomNode(refChild));
}
@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
return document.replaceChild(getDomNode(newChild), getDomNode(oldChild));
}
@Override
public Node removeChild(Node oldChild) throws DOMException {
return document.removeChild(getDomNode(oldChild));
}
@Override
public Node appendChild(Node newChild) throws DOMException {
return document.appendChild(getDomNode(newChild));
}
@Override
public boolean hasChildNodes() {
return document.hasChildNodes();
}
@Override
public Node cloneNode(boolean deep) {
SOAPPartImpl newSoapPart = getSOAPPart().doCloneNode();
super.cloneNode(newSoapPart.getDocument(), deep);
return newSoapPart;
return document.cloneNode(deep);
}
public void cloneNode(SOAPDocumentImpl newdoc, boolean deep) {
super.cloneNode(newdoc, deep);
@Override
public void normalize() {
document.normalize();
}
@Override
public boolean isSupported(String feature, String version) {
return document.isSupported(feature, version);
}
@Override
public String getNamespaceURI() {
return document.getNamespaceURI();
}
@Override
public String getPrefix() {
return document.getPrefix();
}
@Override
public void setPrefix(String prefix) throws DOMException {
document.setPrefix(prefix);
}
@Override
public String getLocalName() {
return document.getLocalName();
}
@Override
public boolean hasAttributes() {
return document.hasAttributes();
}
@Override
public String getBaseURI() {
return document.getBaseURI();
}
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return document.compareDocumentPosition(other);
}
@Override
public String getTextContent() throws DOMException {
return document.getTextContent();
}
@Override
public void setTextContent(String textContent) throws DOMException {
document.setTextContent(textContent);
}
@Override
public boolean isSameNode(Node other) {
return document.isSameNode(other);
}
@Override
public String lookupPrefix(String namespaceURI) {
return document.lookupPrefix(namespaceURI);
}
@Override
public boolean isDefaultNamespace(String namespaceURI) {
return document.isDefaultNamespace(namespaceURI);
}
@Override
public String lookupNamespaceURI(String prefix) {
return document.lookupNamespaceURI(prefix);
}
@Override
public boolean isEqualNode(Node arg) {
return document.isEqualNode(arg);
}
@Override
public Object getFeature(String feature, String version) {
return document.getFeature(feature, version);
}
@Override
public Object setUserData(String key, Object data, UserDataHandler handler) {
return document.setUserData(key, data, handler);
}
@Override
public Object getUserData(String key) {
return document.getUserData(key);
}
public Document getDomDocument() {
return document;
}
/**
* Insert a mapping information for {@link org.w3c.dom.Node} - {@link javax.xml.soap.Node}.
*
* In SAAJ, elements in DOM are expected to be interfaces of SAAJ, on the other hand in JDKs Xerces,
* they are casted to internal impl classes. After removal of SAAJ dependency
* to JDKs internal classes elements in DOM can never be both of them.
*
* @param node SAAJ wrapper node for w3c DOM node
*/
public void register(javax.xml.soap.Node node) {
final Node domElement = getDomNode(node);
if (domToSoap.containsKey(domElement)) {
throw new IllegalStateException("Element " + domElement.getNodeName()
+ " is already registered");
}
domToSoap.put(domElement, node);
}
/**
* Find a soap wrapper for w3c dom node.
*
* @param node w3c dom node nullable
* @return soap wrapper for w3c dom node
*
* @throws
*/
public javax.xml.soap.Node find(Node node) {
return find(node, true);
}
private javax.xml.soap.Node find(Node node, boolean required) {
if (node == null) {
return null;
}
if (node instanceof javax.xml.soap.Node) {
return (javax.xml.soap.Node) node;
}
final javax.xml.soap.Node found = domToSoap.get(node);
if (found == null && required) {
throw new IllegalArgumentException(MessageFormat.format("Cannot find SOAP wrapper for element {0}", node));
}
return found;
}
/**
* If corresponding soap wrapper exists for w3c dom node it is returned,
* if not passed dom element is returned.
*
* @param node w3c dom node
* @return soap wrapper or passed w3c dom node if not found
*/
public Node findIfPresent(Node node) {
final javax.xml.soap.Node found = find(node, false);
return found != null ? found : node;
}
/**
* Extracts w3c dom node from corresponding soap wrapper.
*
* @param node soap or dom nullable
* @return dom node
*/
public Node getDomNode(Node node) {
if (node instanceof SOAPDocumentImpl) {
return ((SOAPDocumentImpl)node).getDomElement();
} else if (node instanceof ElementImpl) {
return ((ElementImpl) node).getDomElement();
} else if (node instanceof SOAPTextImpl) {
return ((SOAPTextImpl)node).getDomElement();
} else if (node instanceof SOAPCommentImpl) {
return ((SOAPCommentImpl)node).getDomElement();
} else if (node instanceof CDATAImpl) {
return ((CDATAImpl) node).getDomElement();
}
return node;
}
public Document getDomElement() {
return document;
}
@Override
public String getValue() {
throw new UnsupportedOperationException();
}
@Override
public void setValue(String value) {
throw new UnsupportedOperationException();
}
@Override
public void setParentElement(SOAPElement parent) throws SOAPException {
throw new UnsupportedOperationException();
}
@Override
public SOAPElement getParentElement() {
throw new UnsupportedOperationException();
}
@Override
public void detachNode() {
throw new UnsupportedOperationException();
}
@Override
public void recycleNode() {
throw new UnsupportedOperationException();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -25,29 +25,56 @@
package com.sun.xml.internal.messaging.saaj.soap;
import java.io.*;
import java.util.Iterator;
import java.util.logging.Logger;
import java.util.logging.Level;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.xml.soap.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.*;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeBodyPart;
import com.sun.xml.internal.messaging.saaj.soap.impl.ElementImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.*;
import com.sun.xml.internal.messaging.saaj.util.ByteInputStream;
import com.sun.xml.internal.messaging.saaj.util.ByteOutputStream;
import com.sun.xml.internal.messaging.saaj.util.FastInfosetReflection;
import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import com.sun.xml.internal.messaging.saaj.util.MimeHeadersUtil;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.EntityReference;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.UserDataHandler;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPPart;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PushbackReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* SOAPPartImpl is the first attachment. This contains the XML/SOAP document.
@ -128,20 +155,21 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
envelope = createEnvelopeFromSource();
} else {
envelope = createEmptyEnvelope(null);
document.insertBefore(envelope, null);
document.insertBefore(((EnvelopeImpl) envelope).getDomElement(), null);
}
return envelope;
}
protected void lookForEnvelope() throws SOAPException {
Element envelopeChildElement = document.doGetDocumentElement();
if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
envelope = (EnvelopeImpl) envelopeChildElement;
} else if (!(envelopeChildElement instanceof ElementImpl)) {
org.w3c.dom.Node soapEnvelope = document.findIfPresent(envelopeChildElement);
if (soapEnvelope == null || soapEnvelope instanceof Envelope) {
envelope = (EnvelopeImpl) soapEnvelope;
} else if (document.find(envelopeChildElement) == null) {
log.severe("SAAJ0512.soap.incorrect.factory.used");
throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
} else {
ElementImpl soapElement = (ElementImpl) envelopeChildElement;
ElementImpl soapElement = (ElementImpl) document.find(envelopeChildElement);
if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
String prefix = soapElement.getPrefix();
String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
@ -498,7 +526,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public NamedNodeMap getAttributes() {
return document.getAttributes();
return document.getDomDocument().getAttributes();
}
public NodeList getChildNodes() {
@ -517,11 +545,11 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String getLocalName() {
return document.getLocalName();
return document.getDomDocument().getLocalName();
}
public String getNamespaceURI() {
return document.getNamespaceURI();
return document.getDomDocument().getNamespaceURI();
}
public org.w3c.dom.Node getNextSibling() {
@ -530,11 +558,11 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String getNodeName() {
return document.getNodeName();
return document.getDomDocument().getNodeName();
}
public short getNodeType() {
return document.getNodeType();
return document.getDomDocument().getNodeType();
}
public String getNodeValue() throws DOMException {
@ -542,23 +570,23 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public Document getOwnerDocument() {
return document.getOwnerDocument();
return document.getDomDocument().getOwnerDocument();
}
public org.w3c.dom.Node getParentNode() {
return document.getParentNode();
return document.getDomDocument().getParentNode();
}
public String getPrefix() {
return document.getPrefix();
return document.getDomDocument().getPrefix();
}
public org.w3c.dom.Node getPreviousSibling() {
return document.getPreviousSibling();
return document.getDomDocument().getPreviousSibling();
}
public boolean hasAttributes() {
return document.hasAttributes();
return document.getDomDocument().hasAttributes();
}
public boolean hasChildNodes() {
@ -575,7 +603,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public boolean isSupported(String arg0, String arg1) {
return document.isSupported(arg0, arg1);
return document.getDomDocument().isSupported(arg0, arg1);
}
public void normalize() {
@ -686,7 +714,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public DOMConfiguration getDomConfig() {
return document.getDomConfig();
return document.getDomDocument().getDomConfig();
}
public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException {
@ -699,7 +727,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String getDocumentURI() {
return document.getDocumentURI();
return document.getDomDocument().getDocumentURI();
}
public void setStrictErrorChecking(boolean strictErrorChecking) {
@ -707,15 +735,15 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String getInputEncoding() {
return document.getInputEncoding();
return document.getDomDocument().getInputEncoding();
}
public String getXmlEncoding() {
return document.getXmlEncoding();
return document.getDomDocument().getXmlEncoding();
}
public boolean getXmlStandalone() {
return document.getXmlStandalone();
return document.getDomDocument().getXmlStandalone();
}
public void setXmlStandalone(boolean xmlStandalone) throws DOMException {
@ -723,7 +751,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String getXmlVersion() {
return document.getXmlVersion();
return document.getDomDocument().getXmlVersion();
}
public void setXmlVersion(String xmlVersion) throws DOMException {
@ -731,12 +759,12 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public boolean getStrictErrorChecking() {
return document.getStrictErrorChecking();
return document.getDomDocument().getStrictErrorChecking();
}
// DOM L3 methods from org.w3c.dom.Node
public String getBaseURI() {
return document.getBaseURI();
return document.getDomDocument().getBaseURI();
}
public short compareDocumentPosition(org.w3c.dom.Node other)
@ -758,7 +786,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public String lookupPrefix(String namespaceURI) {
return document.lookupPrefix(namespaceURI);
return document.getDomDocument().lookupPrefix(namespaceURI);
}
public boolean isDefaultNamespace(String namespaceURI) {
@ -770,7 +798,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public boolean isEqualNode(org.w3c.dom.Node arg) {
return document.isEqualNode(arg);
return document.getDomDocument().isEqualNode(arg);
}
public Object getFeature(String feature,
@ -785,7 +813,7 @@ public abstract class SOAPPartImpl extends SOAPPart implements SOAPDocument {
}
public Object getUserData(String key) {
return document.getUserData(key);
return document.getDomDocument().getUserData(key);
}
public void recycleNode() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -63,6 +63,9 @@ public class SOAPVersionMismatchException extends SOAPExceptionImpl {
/**
* Constructs a <code>SOAPExceptionImpl</code> object initialized
* with the given <code>Throwable</code> object.
*
* @param cause a <code>Throwable</code> object that is to
* be embedded in this <code>SOAPExceptionImpl</code> object
*/
public SOAPVersionMismatchException(Throwable cause) {
super(cause);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -33,7 +33,7 @@ import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.MimeUtility;
import com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ContentType;
/**
* JAF data content handler for text/plain --> String
* JAF data content handler for text/plain --&gt; String
*
*/
public class StringDataContentHandler implements DataContentHandler {
@ -51,6 +51,7 @@ public class StringDataContentHandler implements DataContentHandler {
*
* @return The DataFlavors
*/
@Override
public DataFlavor[] getTransferDataFlavors() {
return new DataFlavor[] { getDF() };
}
@ -62,6 +63,7 @@ public class StringDataContentHandler implements DataContentHandler {
* @param ds The DataSource corresponding to the data
* @return String object
*/
@Override
public Object getTransferData(DataFlavor df, DataSource ds)
throws IOException {
// use myDF.equals to be sure to get ActivationDataFlavor.equals,
@ -72,6 +74,7 @@ public class StringDataContentHandler implements DataContentHandler {
return null;
}
@Override
public Object getContent(DataSource ds) throws IOException {
String enc = null;
InputStreamReader is = null;
@ -120,6 +123,7 @@ public class StringDataContentHandler implements DataContentHandler {
/**
* Write the object to the output stream, using the specified MIME type.
*/
@Override
public void writeTo(Object obj, String type, OutputStream os)
throws IOException {
if (!(obj instanceof String))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -56,6 +56,7 @@ public class XmlDataContentHandler implements DataContentHandler {
* return the DataFlavors for this <code>DataContentHandler</code>
* @return The DataFlavors.
*/
@Override
public DataFlavor[] getTransferDataFlavors() { // throws Exception;
DataFlavor flavors[] = new DataFlavor[2];
@ -69,10 +70,11 @@ public class XmlDataContentHandler implements DataContentHandler {
/**
* return the Transfer Data of type DataFlavor from InputStream
* @param df The DataFlavor.
* @param ins The InputStream corresponding to the data.
* @param flavor The DataFlavor.
* @param dataSource The DataSource.
* @return The constructed Object.
*/
@Override
public Object getTransferData(DataFlavor flavor, DataSource dataSource)
throws IOException {
if (flavor.getMimeType().startsWith("text/xml") ||
@ -87,6 +89,7 @@ public class XmlDataContentHandler implements DataContentHandler {
/**
*
*/
@Override
public Object getContent(DataSource dataSource) throws IOException {
return new StreamSource(dataSource.getInputStream());
}
@ -96,6 +99,7 @@ public class XmlDataContentHandler implements DataContentHandler {
* (similar semantically to previous method, we are deciding
* which one to support)
*/
@Override
public void writeTo(Object obj, String mimeType, OutputStream os)
throws IOException {
if (!mimeType.startsWith("text/xml") && !mimeType.startsWith("application/xml"))

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -36,6 +36,7 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.*;
import org.w3c.dom.Node;
@ -60,6 +61,10 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
super(ownerDoc, bodyName);
}
public BodyImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract NameImpl getFaultName(String name);
protected abstract boolean isFault(SOAPElement child);
protected abstract SOAPBodyElement createBodyElement(Name name);
@ -155,7 +160,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
if (hasFault()) {
if (fault == null) {
//initialize fault member
fault = (SOAPFault) getFirstChildElement();
fault = (SOAPFault) getSoapDocument().find(getFirstChildElement());
}
return fault;
}
@ -259,11 +264,12 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
}
protected SOAPElement convertToSoapElement(Element element) {
if ((element instanceof SOAPBodyElement) &&
final Node soapNode = getSoapDocument().findIfPresent(element);
if ((soapNode instanceof SOAPBodyElement) &&
//this check is required because ElementImpl currently
// implements SOAPBodyElement
!(element.getClass().equals(ElementImpl.class))) {
return (SOAPElement) element;
!(soapNode.getClass().equals(ElementImpl.class))) {
return (SOAPElement) soapNode;
} else {
return replaceElementWithSOAPElement(
element,
@ -314,7 +320,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
Document document = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance("com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl", SAAJUtil.getSystemClassLoader());
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.newDocument();
@ -440,7 +446,7 @@ public abstract class BodyImpl extends ElementImpl implements SOAPBody {
//not lazy -Just get first child element and return its attribute
Element elem = getFirstChildElement();
if (elem != null) {
return elem.getAttribute(localName);
return elem.getAttribute(getLocalName());
}
}
return null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -32,10 +32,17 @@ import javax.xml.soap.SOAPException;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.CDATASection;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.w3c.dom.UserDataHandler;
public class CDATAImpl
extends com.sun.org.apache.xerces.internal.dom.CDATASectionImpl
implements javax.xml.soap.Text {
public class CDATAImpl implements CDATASection, javax.xml.soap.Text {
protected static final Logger log =
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
@ -44,8 +51,256 @@ public class CDATAImpl
static final String cdataUC = "<![CDATA[";
static final String cdataLC = "<![cdata[";
@Override
public Text splitText(int offset) throws DOMException {
return cdataSection.splitText(offset);
}
@Override
public boolean isElementContentWhitespace() {
return cdataSection.isElementContentWhitespace();
}
@Override
public String getWholeText() {
return cdataSection.getWholeText();
}
@Override
public Text replaceWholeText(String content) throws DOMException {
return cdataSection.replaceWholeText(content);
}
@Override
public String getData() throws DOMException {
return cdataSection.getData();
}
@Override
public void setData(String data) throws DOMException {
cdataSection.setData(data);
}
@Override
public int getLength() {
return cdataSection.getLength();
}
@Override
public String substringData(int offset, int count) throws DOMException {
return cdataSection.substringData(offset, count);
}
@Override
public void appendData(String arg) throws DOMException {
cdataSection.appendData(arg);
}
@Override
public void insertData(int offset, String arg) throws DOMException {
cdataSection.insertData(offset, arg);
}
@Override
public void deleteData(int offset, int count) throws DOMException {
cdataSection.deleteData(offset, count);
}
@Override
public void replaceData(int offset, int count, String arg) throws DOMException {
cdataSection.replaceData(offset, count, arg);
}
@Override
public String getNodeName() {
return cdataSection.getNodeName();
}
@Override
public String getNodeValue() throws DOMException {
return cdataSection.getNodeValue();
}
@Override
public void setNodeValue(String nodeValue) throws DOMException {
cdataSection.setNodeValue(nodeValue);
}
@Override
public short getNodeType() {
return cdataSection.getNodeType();
}
@Override
public Node getParentNode() {
return cdataSection.getParentNode();
}
@Override
public NodeList getChildNodes() {
return cdataSection.getChildNodes();
}
@Override
public Node getFirstChild() {
return cdataSection.getFirstChild();
}
@Override
public Node getLastChild() {
return cdataSection.getLastChild();
}
@Override
public Node getPreviousSibling() {
return cdataSection.getPreviousSibling();
}
@Override
public Node getNextSibling() {
return cdataSection.getNextSibling();
}
@Override
public NamedNodeMap getAttributes() {
return cdataSection.getAttributes();
}
@Override
public Document getOwnerDocument() {
return cdataSection.getOwnerDocument();
}
@Override
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
return cdataSection.insertBefore(newChild, refChild);
}
@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
return cdataSection.replaceChild(newChild, oldChild);
}
@Override
public Node removeChild(Node oldChild) throws DOMException {
return cdataSection.removeChild(oldChild);
}
@Override
public Node appendChild(Node newChild) throws DOMException {
return cdataSection.appendChild(newChild);
}
@Override
public boolean hasChildNodes() {
return cdataSection.hasChildNodes();
}
@Override
public Node cloneNode(boolean deep) {
return cdataSection.cloneNode(deep);
}
@Override
public void normalize() {
cdataSection.normalize();
}
@Override
public boolean isSupported(String feature, String version) {
return cdataSection.isSupported(feature, version);
}
@Override
public String getNamespaceURI() {
return cdataSection.getNamespaceURI();
}
@Override
public String getPrefix() {
return cdataSection.getPrefix();
}
@Override
public void setPrefix(String prefix) throws DOMException {
cdataSection.setPrefix(prefix);
}
@Override
public String getLocalName() {
return cdataSection.getLocalName();
}
@Override
public boolean hasAttributes() {
return cdataSection.hasAttributes();
}
@Override
public String getBaseURI() {
return cdataSection.getBaseURI();
}
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return cdataSection.compareDocumentPosition(other);
}
@Override
public String getTextContent() throws DOMException {
return cdataSection.getTextContent();
}
@Override
public void setTextContent(String textContent) throws DOMException {
cdataSection.setTextContent(textContent);
}
@Override
public boolean isSameNode(Node other) {
return cdataSection.isSameNode(other);
}
@Override
public String lookupPrefix(String namespaceURI) {
return cdataSection.lookupPrefix(namespaceURI);
}
@Override
public boolean isDefaultNamespace(String namespaceURI) {
return cdataSection.isDefaultNamespace(namespaceURI);
}
@Override
public String lookupNamespaceURI(String prefix) {
return cdataSection.lookupNamespaceURI(prefix);
}
@Override
public boolean isEqualNode(Node arg) {
return cdataSection.isEqualNode(arg);
}
@Override
public Object getFeature(String feature, String version) {
return cdataSection.getFeature(feature, version);
}
@Override
public Object setUserData(String key, Object data, UserDataHandler handler) {
return cdataSection.setUserData(key, data, handler);
}
@Override
public Object getUserData(String key) {
return cdataSection.getUserData(key);
}
private CDATASection cdataSection;
public CDATAImpl(SOAPDocumentImpl ownerDoc, String text) {
super(ownerDoc, text);
cdataSection = ownerDoc.getDomDocument().createCDATASection(text);
ownerDoc.register(this);
}
public String getValue() {
@ -87,4 +342,8 @@ public class CDATAImpl
public boolean isComment() {
return false;
}
public CDATASection getDomElement() {
return cdataSection;
}
}

View File

@ -31,6 +31,7 @@ import java.util.NoSuchElementException;
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.Element;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
@ -41,6 +42,10 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
super(ownerDoc, detailName);
}
public DetailImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract DetailEntry createDetailEntry(Name name);
protected abstract DetailEntry createDetailEntry(QName name);
@ -65,8 +70,9 @@ public abstract class DetailImpl extends FaultElementImpl implements Detail {
}
protected SOAPElement convertToSoapElement(Element element) {
if (element instanceof DetailEntry) {
return (SOAPElement) element;
final javax.xml.soap.Node soapNode = getSoapDocument().find(element);
if (soapNode instanceof DetailEntry) {
return (SOAPElement) soapNode;
} else {
DetailEntry detailEntry =
createDetailEntry(NameImpl.copyElementName(element));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -30,8 +30,22 @@ import javax.xml.soap.*;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.*;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.*;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Body1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Detail1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Fault1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.FaultElement1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.Header1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Body1_2Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Detail1_2Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Envelope1_2Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Fault1_2Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.Header1_2Impl;
import com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPPart1_2Impl;
import org.w3c.dom.Element;
import java.util.Objects;
public class ElementFactory {
@ -54,6 +68,72 @@ public class ElementFactory {
name.getNamespaceURI());
}
/**
* Create element wrapper for existing DOM element.
*
* @param ownerDocument SOAP document wrapper not null
* @param element DOM element not null
* @return SOAP wrapper for DOM element
*/
public static SOAPElement createElement(SOAPDocumentImpl ownerDocument, Element element) {
Objects.requireNonNull(ownerDocument);
Objects.requireNonNull(element);
String localName = element.getLocalName();
String namespaceUri = element.getNamespaceURI();
String prefix = element.getPrefix();
if ("Envelope".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_2Impl(ownerDocument, element);
}
}
if ("Body".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Body1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Body1_2Impl(ownerDocument, element);
}
}
if ("Header".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Header1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Header1_2Impl(ownerDocument, element);
}
}
if ("Fault".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Fault1_1Impl(element, ownerDocument);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Fault1_2Impl(element, ownerDocument);
}
}
if ("Detail".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Detail1_1Impl(ownerDocument, element);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Detail1_2Impl(ownerDocument, element);
}
}
if ("faultcode".equalsIgnoreCase(localName)
|| "faultstring".equalsIgnoreCase(localName)
|| "faultactor".equalsIgnoreCase(localName)) {
// SOAP 1.2 does not have fault(code/string/actor)
// So there is no else case required
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new FaultElement1_1Impl(ownerDocument,
localName,
prefix);
}
}
return new ElementImpl(ownerDocument, element);
}
public static SOAPElement createElement(
SOAPDocumentImpl ownerDocument,
String localName,
@ -92,28 +172,28 @@ public class ElementFactory {
prefix = NameImpl.SOAP_ENVELOPE_PREFIX;
}
if (localName.equalsIgnoreCase("Envelope")) {
if ("Envelope".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_1Impl(ownerDocument, prefix);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Envelope1_2Impl(ownerDocument, prefix);
}
}
if (localName.equalsIgnoreCase("Body")) {
if ("Body".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Body1_1Impl(ownerDocument, prefix);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Body1_2Impl(ownerDocument, prefix);
}
}
if (localName.equalsIgnoreCase("Header")) {
if ("Header".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Header1_1Impl(ownerDocument, prefix);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Header1_2Impl(ownerDocument, prefix);
}
}
if (localName.equalsIgnoreCase("Fault")) {
if ("Fault".equalsIgnoreCase(localName)) {
SOAPFault fault = null;
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
fault = new Fault1_1Impl(ownerDocument, prefix);
@ -139,16 +219,16 @@ public class ElementFactory {
}
}
if (localName.equalsIgnoreCase("Detail")) {
if ("Detail".equalsIgnoreCase(localName)) {
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
return new Detail1_1Impl(ownerDocument, prefix);
} else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
return new Detail1_2Impl(ownerDocument, prefix);
}
}
if (localName.equalsIgnoreCase("faultcode")
|| localName.equalsIgnoreCase("faultstring")
|| localName.equalsIgnoreCase("faultactor")) {
if ("faultcode".equalsIgnoreCase(localName)
|| "faultstring".equalsIgnoreCase(localName)
|| "faultactor".equalsIgnoreCase(localName)) {
// SOAP 1.2 does not have fault(code/string/actor)
// So there is no else case required
if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {

View File

@ -43,9 +43,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.*;
public class ElementImpl
extends com.sun.org.apache.xerces.internal.dom.ElementNSImpl
implements SOAPElement, SOAPBodyElement {
public class ElementImpl implements SOAPElement, SOAPBodyElement {
public static final String DSIG_NS = "http://www.w3.org/2000/09/xmldsig#".intern();
public static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern();
@ -55,6 +53,69 @@ public class ElementImpl
protected QName elementQName;
private Element element;
private SOAPDocumentImpl soapDocument;
@Override
public String getTagName() {
return element.getTagName();
}
@Override
public String getAttribute(String name) {
return element.getAttribute(name);
}
@Override
public void setAttribute(String name, String value) throws DOMException {
boolean isQualifiedName = (name.indexOf(":") > 0);
//this is because of BugfixTest#testCR7020991, after removal internal dependencies
//SOAPDocumentImpl#createAttribute is not called anymore from xerces parent
if (isQualifiedName) {
String nsUri = null;
String prefix = name.substring(0, name.indexOf(":"));
//cannot do anything to resolve the URI if prefix is not
//XMLNS.
if (XMLNS.equals(prefix)) {
nsUri = ElementImpl.XMLNS_URI;
setAttributeNS(nsUri, name, value);
return;
}
}
element.setAttribute(name, value);
}
@Override
public void removeAttribute(String name) throws DOMException {
element.removeAttribute(name);
}
@Override
public Attr getAttributeNode(String name) {
return element.getAttributeNode(name);
}
@Override
public Attr setAttributeNode(Attr newAttr) throws DOMException {
return element.setAttributeNode(newAttr);
}
@Override
public Attr removeAttributeNode(Attr oldAttr) throws DOMException {
return element.removeAttributeNode(oldAttr);
}
@Override
public NodeList getElementsByTagName(String name) {
return new NodeListImpl(getSoapDocument(), element.getElementsByTagName(name));
}
@Override
public String getAttributeNS(String namespaceURI, String localName) throws DOMException {
return element.getAttributeNS(namespaceURI, localName);
}
protected static final Logger log =
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
@ -72,22 +133,27 @@ public class ElementImpl
*/
public final static String XML_URI = "http://www.w3.org/XML/1998/namespace".intern();
private final static String XMLNS = "xmlns".intern();
public ElementImpl(SOAPDocumentImpl ownerDoc, Name name) {
super(
ownerDoc,
name.getURI(),
name.getQualifiedName(),
name.getLocalName());
this.soapDocument = ownerDoc;
this.element = ownerDoc.getDomDocument().createElementNS(name.getURI(), name.getQualifiedName());
elementQName = NameImpl.convertToQName(name);
getSoapDocument().register(this);
}
public ElementImpl(SOAPDocumentImpl ownerDoc, QName name) {
super(
ownerDoc,
name.getNamespaceURI(),
getQualifiedName(name),
name.getLocalPart());
this.soapDocument = ownerDoc;
this.element = ownerDoc.getDomDocument().createElementNS(name.getNamespaceURI(), getQualifiedName(name));
elementQName = name;
getSoapDocument().register(this);
}
public ElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
this.element = domElement;
this.soapDocument = ownerDoc;
this.elementQName = new QName(domElement.getNamespaceURI(), domElement.getLocalName());
getSoapDocument().register(this);
}
public ElementImpl(
@ -95,9 +161,11 @@ public class ElementImpl
String uri,
String qualifiedName) {
super(ownerDoc, uri, qualifiedName);
this.soapDocument = ownerDoc;
this.element = ownerDoc.getDomDocument().createElementNS(uri, qualifiedName);
elementQName =
new QName(uri, getLocalPart(qualifiedName), getPrefix(qualifiedName));
getSoapDocument().register(this);
}
public void ensureNamespaceIsDeclared(String prefix, String uri) {
@ -111,11 +179,132 @@ public class ElementImpl
}
public Document getOwnerDocument() {
Document doc = super.getOwnerDocument();
if (doc instanceof SOAPDocument)
return ((SOAPDocument) doc).getDocument();
else
return doc;
return soapDocument;
}
@Override
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
return element.insertBefore(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(refChild));
}
@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
return element.replaceChild(getSoapDocument().getDomNode(newChild), getSoapDocument().getDomNode(oldChild));
}
@Override
public Node removeChild(Node oldChild) throws DOMException {
return element.removeChild(getSoapDocument().getDomNode(oldChild));
}
@Override
public Node appendChild(Node newChild) throws DOMException {
return element.appendChild(getSoapDocument().getDomNode(newChild));
}
@Override
public boolean hasChildNodes() {
return element.hasChildNodes();
}
@Override
public Node cloneNode(boolean deep) {
return element.cloneNode(deep);
}
@Override
public void normalize() {
element.normalize();
}
@Override
public boolean isSupported(String feature, String version) {
return element.isSupported(feature, version);
}
@Override
public String getNamespaceURI() {
return element.getNamespaceURI();
}
@Override
public String getPrefix() {
return element.getPrefix();
}
@Override
public void setPrefix(String prefix) throws DOMException {
element.setPrefix(prefix);
}
@Override
public String getLocalName() {
return element.getLocalName();
}
@Override
public boolean hasAttributes() {
return element.hasAttributes();
}
@Override
public String getBaseURI() {
return element.getBaseURI();
}
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return element.compareDocumentPosition(other);
}
@Override
public String getTextContent() throws DOMException {
return element.getTextContent();
}
@Override
public void setTextContent(String textContent) throws DOMException {
element.setTextContent(textContent);
}
@Override
public boolean isSameNode(Node other) {
return element.isSameNode(other);
}
@Override
public String lookupPrefix(String namespaceURI) {
return element.lookupPrefix(namespaceURI);
}
@Override
public boolean isDefaultNamespace(String namespaceURI) {
return element.isDefaultNamespace(namespaceURI);
}
@Override
public String lookupNamespaceURI(String prefix) {
return element.lookupNamespaceURI(prefix);
}
@Override
public boolean isEqualNode(Node arg) {
return element.isEqualNode(arg);
}
@Override
public Object getFeature(String feature, String version) {
return element.getFeature(feature, version);
}
@Override
public Object setUserData(String key, Object data, UserDataHandler handler) {
return element.setUserData(key, data, handler);
}
@Override
public Object getUserData(String key) {
return element.getUserData(key);
}
public SOAPElement addChildElement(Name name) throws SOAPException {
@ -353,13 +542,16 @@ public class ElementImpl
// preserve the encodingStyle attr as it may get lost in the import
String encodingStyle = element.getEncodingStyle();
ElementImpl importedElement = (ElementImpl) importElement(element);
final Element domElement = ((ElementImpl) element).getDomElement();
final Element importedElement = importElement(domElement);
addNode(importedElement);
if (encodingStyle != null)
importedElement.setEncodingStyle(encodingStyle);
final SOAPElement converted = convertToSoapElement(importedElement);
return convertToSoapElement(importedElement);
if (encodingStyle != null)
converted.setEncodingStyle(encodingStyle);
return converted;
}
protected Element importElement(Element element) {
@ -374,7 +566,7 @@ public class ElementImpl
protected SOAPElement addElement(Name name) throws SOAPException {
SOAPElement newElement = createElement(name);
addNode(newElement);
addNode(((ElementImpl) newElement).getDomElement());
return newElement;
}
@ -411,7 +603,7 @@ public class ElementImpl
}
protected void addNode(org.w3c.dom.Node newElement) throws SOAPException {
insertBefore(newElement, null);
insertBefore(getSoapDocument().getDomNode(newElement), null);
if (getOwnerDocument() instanceof DocumentFragment)
return;
@ -431,7 +623,7 @@ public class ElementImpl
Node child = getFirstChild();
while (child != null) {
if (child instanceof Element) {
return ((Element) child);
return (Element) getSoapDocument().find(child);
}
child = child.getNextSibling();
}
@ -441,10 +633,12 @@ public class ElementImpl
protected SOAPElement findChild(NameImpl name) {
Node eachChild = getFirstChild();
while (eachChild != null) {
if (eachChild instanceof SOAPElement) {
SOAPElement eachChildSoap = (SOAPElement) eachChild;
if (eachChildSoap.getElementName().equals(name)) {
return eachChildSoap;
if (eachChild instanceof Element) {
SOAPElement eachChildSoap = (SOAPElement) getSoapDocument().find(eachChild);
if (eachChildSoap != null) {
if (eachChildSoap.getElementName().equals(name)) {
return eachChildSoap;
}
}
}
eachChild = eachChild.getNextSibling();
@ -474,14 +668,14 @@ public class ElementImpl
protected SOAPElement addCDATA(String text) throws SOAPException {
org.w3c.dom.Text cdata =
(org.w3c.dom.Text) getOwnerDocument().createCDATASection(text);
getOwnerDocument().createCDATASection(text);
addNode(cdata);
return this;
}
protected SOAPElement addText(String text) throws SOAPException {
org.w3c.dom.Text textNode =
(org.w3c.dom.Text) getOwnerDocument().createTextNode(text);
getOwnerDocument().createTextNode(text);
addNode(textNode);
return this;
}
@ -684,8 +878,9 @@ public class ElementImpl
}
protected SOAPElement convertToSoapElement(Element element) {
if (element instanceof SOAPElement) {
return (SOAPElement) element;
final Node soapNode = getSoapDocument().findIfPresent(element);
if (soapNode instanceof SOAPElement) {
return (SOAPElement) soapNode;
} else {
return replaceElementWithSOAPElement(
element,
@ -693,7 +888,7 @@ public class ElementImpl
}
}
protected static SOAPElement replaceElementWithSOAPElement(
protected SOAPElement replaceElementWithSOAPElement(
Element element,
ElementImpl copy) {
@ -709,7 +904,7 @@ public class ElementImpl
copy.insertBefore(nextChild, null);
}
Node parent = element.getParentNode();
Node parent = getSoapDocument().find(element.getParentNode());
if (parent != null) {
parent.replaceChild(copy, element);
} // XXX else throw an exception?
@ -727,8 +922,8 @@ public class ElementImpl
if (next == null) {
while (eachNode.hasNext()) {
Node node = eachNode.next();
if (node instanceof SOAPElement) {
next = node;
if (node instanceof Element) {
next = getSoapDocument().findIfPresent(node);
break;
}
}
@ -899,14 +1094,14 @@ public class ElementImpl
protected javax.xml.soap.Node getValueNode() {
Iterator<Node> i = getChildElements();
while (i.hasNext()) {
javax.xml.soap.Node n = (javax.xml.soap.Node) i.next();
Node n = i.next();
if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE ||
n.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE) {
// TODO: Hack to fix text node split into multiple lines.
normalize();
// Should remove the normalization step when this gets fixed in
// DOM/Xerces.
return (javax.xml.soap.Node) n;
return getSoapDocument().find(n);
}
}
return null;
@ -948,7 +1143,7 @@ public class ElementImpl
if (parentNode instanceof SOAPDocument) {
return null;
}
return (SOAPElement) parentNode;
return (SOAPElement) getSoapDocument().find(parentNode);
}
protected String getSOAPNamespace() {
@ -975,7 +1170,7 @@ public class ElementImpl
public void detachNode() {
Node parent = getParentNode();
if (parent != null) {
parent.removeChild(this);
parent.removeChild(element);
}
encodingStyleAttribute.clearNameAndValue();
// Fix for CR: 6474641
@ -1136,17 +1331,18 @@ public class ElementImpl
return attribute == null ? null : attribute.getValue();
}
protected static Iterator<Node> getChildElementsFrom(final Element element) {
protected Iterator<Node> getChildElementsFrom(final Element element) {
return new Iterator<Node>() {
Node next = element.getFirstChild();
Node nextNext = null;
Node last = null;
Node soapElement = getSoapDocument().findIfPresent(element);
public boolean hasNext() {
if (next != null) {
return true;
}
if (next == null && nextNext != null) {
if (nextNext != null) {
next = nextNext;
}
@ -1158,15 +1354,15 @@ public class ElementImpl
last = next;
next = null;
if ((element instanceof ElementImpl)
&& (last instanceof Element)) {
if ((soapElement instanceof ElementImpl)
&& (last instanceof Element)) {
last =
((ElementImpl) element).convertToSoapElement(
(Element) last);
((ElementImpl) soapElement).convertToSoapElement(
(Element) last);
}
nextNext = last.getNextSibling();
return last;
return getSoapDocument().findIfPresent(last);
}
throw new NoSuchElementException();
}
@ -1251,7 +1447,7 @@ public class ElementImpl
// SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(value)))
// return;
super.setAttributeNS(namespaceURI,qualifiedName,value);
element.setAttributeNS(namespaceURI,qualifiedName,value);
//String tmpLocalName = this.getLocalName();
String tmpURI = this.getNamespaceURI();
boolean isIDNS = false;
@ -1270,4 +1466,116 @@ public class ElementImpl
}
@Override
public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
element.removeAttributeNS(namespaceURI, localName);
}
@Override
public Attr getAttributeNodeNS(String namespaceURI, String localName) throws DOMException {
return element.getAttributeNodeNS(namespaceURI, localName);
}
@Override
public Attr setAttributeNodeNS(Attr newAttr) throws DOMException {
return element.setAttributeNodeNS(newAttr);
}
@Override
public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
return new NodeListImpl(getSoapDocument(), element.getElementsByTagNameNS(namespaceURI, localName));
}
@Override
public boolean hasAttribute(String name) {
return element.hasAttribute(name);
}
@Override
public boolean hasAttributeNS(String namespaceURI, String localName) throws DOMException {
return element.hasAttributeNS(namespaceURI, localName);
}
@Override
public TypeInfo getSchemaTypeInfo() {
return element.getSchemaTypeInfo();
}
@Override
public void setIdAttribute(String name, boolean isId) throws DOMException {
element.setIdAttribute(name, isId);
}
@Override
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException {
element.setIdAttributeNS(namespaceURI, localName, isId);
}
@Override
public void setIdAttributeNode(Attr idAttr, boolean isId) throws DOMException {
element.setIdAttributeNode(idAttr, isId);
}
@Override
public String getNodeName() {
return element.getNodeName();
}
@Override
public String getNodeValue() throws DOMException {
return element.getNodeValue();
}
@Override
public void setNodeValue(String nodeValue) throws DOMException {
element.setNodeValue(nodeValue);
}
@Override
public short getNodeType() {
return element.getNodeType();
}
@Override
public Node getParentNode() {
return getSoapDocument().find(element.getParentNode());
}
@Override
public NodeList getChildNodes() {
return new NodeListImpl(getSoapDocument(), element.getChildNodes());
}
@Override
public Node getFirstChild() {
return getSoapDocument().findIfPresent(element.getFirstChild());
}
@Override
public Node getLastChild() {
return getSoapDocument().findIfPresent(element.getLastChild());
}
@Override
public Node getPreviousSibling() {
return getSoapDocument().findIfPresent(element.getPreviousSibling());
}
@Override
public Node getNextSibling() {
return getSoapDocument().findIfPresent(element.getNextSibling());
}
@Override
public NamedNodeMap getAttributes() {
return element.getAttributes();
}
public Element getDomElement() {
return element;
}
public SOAPDocumentImpl getSoapDocument() {
return soapDocument;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -52,6 +52,7 @@ import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTran
import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader;
import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
import org.w3c.dom.Element;
/**
* Our implementation of the SOAP envelope.
@ -92,6 +93,10 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
addBody();
}
public EnvelopeImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract NameImpl getHeaderName(String prefix);
protected abstract NameImpl getBodyName(String prefix);
@ -122,7 +127,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
}
header = (HeaderImpl) createElement(headerName);
insertBefore(header, firstChild);
insertBefore(header.getDomElement(), firstChild);
header.ensureNamespaceIsDeclared(headerName.getPrefix(), headerName.getURI());
return header;
@ -161,7 +166,7 @@ public abstract class EnvelopeImpl extends ElementImpl implements LazyEnvelope {
if (body == null) {
NameImpl bodyName = getBodyName(prefix);
body = (BodyImpl) createElement(bodyName);
insertBefore(body, null);
insertBefore(body.getDomElement(), null);
body.ensureNamespaceIsDeclared(bodyName.getPrefix(), bodyName.getURI());
} else {
log.severe("SAAJ0122.impl.body.already.exists");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -34,6 +34,7 @@ import javax.xml.soap.SOAPFaultElement;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public abstract class FaultElementImpl
extends ElementImpl
@ -47,6 +48,10 @@ public abstract class FaultElementImpl
super(ownerDoc, qname);
}
public FaultElementImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract boolean isStandardFaultElement();
public SOAPElement setElementQName(QName newName) throws SOAPException {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -31,6 +31,7 @@ import java.util.logging.Level;
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.Element;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@ -53,6 +54,9 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
super(ownerDoc, name);
}
public FaultImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract NameImpl getDetailName();
protected abstract NameImpl getFaultCodeName();
@ -83,6 +87,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
(SOAPFaultElement) findAndConvertChildElement(getFaultStringName());
}
@Override
public void setFaultCode(String faultCode) throws SOAPException {
setFaultCode(
NameImpl.getLocalNameFromTagName(faultCode),
@ -131,6 +136,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
}
}
@Override
public void setFaultCode(Name faultCodeQName) throws SOAPException {
setFaultCode(
faultCodeQName.getLocalName(),
@ -138,6 +144,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
faultCodeQName.getURI());
}
@Override
public void setFaultCode(QName faultCodeQName) throws SOAPException {
setFaultCode(
faultCodeQName.getLocalPart(),
@ -165,6 +172,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
detail = (Detail) findAndConvertChildElement(detailName);
}
@Override
public Detail getDetail() {
if (detail == null)
initializeDetail();
@ -175,6 +183,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
return detail;
}
@Override
public Detail addDetail() throws SOAPException {
if (detail == null)
initializeDetail();
@ -188,12 +197,15 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
}
}
@Override
public boolean hasDetail() {
return (getDetail() != null);
}
@Override
public abstract void setFaultActor(String faultActor) throws SOAPException;
@Override
public String getFaultActor() {
if (this.faultActorElement == null)
findFaultActorElement();
@ -203,6 +215,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
return null;
}
@Override
public SOAPElement setElementQName(QName newName) throws SOAPException {
log.log(
@ -213,11 +226,13 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
"Cannot change name for " + elementQName.getLocalPart() + " to " + newName.getLocalPart());
}
@Override
protected SOAPElement convertToSoapElement(Element element) {
if (element instanceof SOAPFaultElement) {
return (SOAPElement) element;
} else if (element instanceof SOAPElement) {
SOAPElement soapElement = (SOAPElement) element;
final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
if (soapNode instanceof SOAPFaultElement) {
return (SOAPElement) soapNode;
} else if (soapNode instanceof SOAPElement) {
SOAPElement soapElement = (SOAPElement) soapNode;
if (getDetailName().equals(soapElement.getElementName())) {
return replaceElementWithSOAPElement(element, createDetail());
} else {
@ -233,12 +248,12 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
Name elementName = NameImpl.copyElementName(element);
ElementImpl newElement;
if (getDetailName().equals(elementName)) {
newElement = (ElementImpl) createDetail();
newElement = createDetail();
} else {
String localName = elementName.getLocalName();
if (isStandardFaultElement(localName))
newElement =
(ElementImpl) createSOAPFaultElement(elementName);
createSOAPFaultElement(elementName);
else
newElement = (ElementImpl) createElement(elementName);
}
@ -284,6 +299,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
}
}
@Override
protected SOAPElement addElement(Name name) throws SOAPException {
if (getDetailName().equals(name)) {
return addDetail();
@ -297,6 +313,7 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
return super.addElement(name);
}
@Override
protected SOAPElement addElement(QName name) throws SOAPException {
return addElement(NameImpl.convertToName(name));
}
@ -311,6 +328,8 @@ public abstract class FaultImpl extends ElementImpl implements SOAPFault {
/**
* Convert an xml:lang attribute value into a Locale object
* @param xmlLang xml:lang attribute value
* @return Locale
*/
protected static Locale xmlLangToLocale(String xmlLang) {
if (xmlLang == null) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -31,6 +31,7 @@ import java.util.logging.Level;
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.Element;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@ -45,6 +46,10 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
super(ownerDoc, name);
}
public HeaderImpl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected abstract SOAPHeaderElement createHeaderElement(Name name)
throws SOAPException;
protected abstract SOAPHeaderElement createHeaderElement(QName name)
@ -276,8 +281,9 @@ public abstract class HeaderImpl extends ElementImpl implements SOAPHeader {
}
protected SOAPElement convertToSoapElement(Element element) {
if (element instanceof SOAPHeaderElement) {
return (SOAPElement) element;
final org.w3c.dom.Node soapNode = getSoapDocument().findIfPresent(element);
if (soapNode instanceof SOAPHeaderElement) {
return (SOAPElement) soapNode;
} else {
SOAPHeaderElement headerElement;
try {

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2017, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.xml.internal.messaging.saaj.soap.impl;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.Objects;
/**
* Node list wrapper, finding SOAP elements automatically when possible.
*
* @author Roman Grigoriadi
*/
public class NodeListImpl implements NodeList {
private final SOAPDocumentImpl soapDocument;
private final NodeList nodeList;
public NodeListImpl(SOAPDocumentImpl soapDocument, NodeList nodeList) {
Objects.requireNonNull(soapDocument);
Objects.requireNonNull(soapDocument);
this.soapDocument = soapDocument;
this.nodeList = nodeList;
}
@Override
public Node item(int index) {
return soapDocument.findIfPresent(nodeList.item(index));
}
@Override
public int getLength() {
return nodeList.getLength();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -31,14 +31,20 @@ import java.util.logging.Logger;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import com.sun.xml.internal.messaging.saaj.util.SAAJUtil;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import org.w3c.dom.UserDataHandler;
public class SOAPCommentImpl
extends com.sun.org.apache.xerces.internal.dom.CommentImpl
implements javax.xml.soap.Text, org.w3c.dom.Comment {
protected static final Logger log =
@ -47,8 +53,236 @@ public class SOAPCommentImpl
protected static ResourceBundle rb =
log.getResourceBundle();
@Override
public String getData() throws DOMException {
return comment.getData();
}
@Override
public void setData(String data) throws DOMException {
comment.setData(data);
}
@Override
public int getLength() {
return comment.getLength();
}
@Override
public String substringData(int offset, int count) throws DOMException {
return comment.substringData(offset, count);
}
@Override
public void appendData(String arg) throws DOMException {
comment.appendData(arg);
}
@Override
public void insertData(int offset, String arg) throws DOMException {
comment.insertData(offset, arg);
}
@Override
public void deleteData(int offset, int count) throws DOMException {
comment.deleteData(offset, count);
}
@Override
public void replaceData(int offset, int count, String arg) throws DOMException {
comment.replaceData(offset, count, arg);
}
@Override
public String getNodeName() {
return comment.getNodeName();
}
@Override
public String getNodeValue() throws DOMException {
return comment.getNodeValue();
}
@Override
public void setNodeValue(String nodeValue) throws DOMException {
comment.setNodeValue(nodeValue);
}
@Override
public short getNodeType() {
return comment.getNodeType();
}
@Override
public Node getParentNode() {
return comment.getParentNode();
}
@Override
public NodeList getChildNodes() {
return comment.getChildNodes();
}
@Override
public Node getFirstChild() {
return comment.getFirstChild();
}
@Override
public Node getLastChild() {
return comment.getLastChild();
}
@Override
public Node getPreviousSibling() {
return comment.getPreviousSibling();
}
@Override
public Node getNextSibling() {
return comment.getNextSibling();
}
@Override
public NamedNodeMap getAttributes() {
return comment.getAttributes();
}
@Override
public Document getOwnerDocument() {
return comment.getOwnerDocument();
}
@Override
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
return comment.insertBefore(newChild, refChild);
}
@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
return comment.replaceChild(newChild, oldChild);
}
@Override
public Node removeChild(Node oldChild) throws DOMException {
return comment.removeChild(oldChild);
}
@Override
public Node appendChild(Node newChild) throws DOMException {
return comment.appendChild(newChild);
}
@Override
public boolean hasChildNodes() {
return comment.hasChildNodes();
}
@Override
public Node cloneNode(boolean deep) {
return comment.cloneNode(deep);
}
@Override
public void normalize() {
comment.normalize();
}
@Override
public boolean isSupported(String feature, String version) {
return comment.isSupported(feature, version);
}
@Override
public String getNamespaceURI() {
return comment.getNamespaceURI();
}
@Override
public String getPrefix() {
return comment.getPrefix();
}
@Override
public void setPrefix(String prefix) throws DOMException {
comment.setPrefix(prefix);
}
@Override
public String getLocalName() {
return comment.getLocalName();
}
@Override
public boolean hasAttributes() {
return comment.hasAttributes();
}
@Override
public String getBaseURI() {
return comment.getBaseURI();
}
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return comment.compareDocumentPosition(other);
}
@Override
public String getTextContent() throws DOMException {
return comment.getTextContent();
}
@Override
public void setTextContent(String textContent) throws DOMException {
comment.setTextContent(textContent);
}
@Override
public boolean isSameNode(Node other) {
return comment.isSameNode(other);
}
@Override
public String lookupPrefix(String namespaceURI) {
return comment.lookupPrefix(namespaceURI);
}
@Override
public boolean isDefaultNamespace(String namespaceURI) {
return comment.isDefaultNamespace(namespaceURI);
}
@Override
public String lookupNamespaceURI(String prefix) {
return comment.lookupNamespaceURI(prefix);
}
@Override
public boolean isEqualNode(Node arg) {
return comment.isEqualNode(arg);
}
@Override
public Object getFeature(String feature, String version) {
return comment.getFeature(feature, version);
}
@Override
public Object setUserData(String key, Object data, UserDataHandler handler) {
return comment.setUserData(key, data, handler);
}
@Override
public Object getUserData(String key) {
return comment.getUserData(key);
}
private Comment comment;
public SOAPCommentImpl(SOAPDocumentImpl ownerDoc, String text) {
super(ownerDoc, text);
comment = ownerDoc.getDomDocument().createComment(text);
ownerDoc.register(this);
}
public String getValue() {
@ -111,4 +345,7 @@ public class SOAPCommentImpl
throw new UnsupportedOperationException("Not Supported");
}
public Comment getDomElement() {
return comment;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -32,17 +32,271 @@ import javax.xml.soap.SOAPException;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.w3c.dom.UserDataHandler;
public class SOAPTextImpl
extends com.sun.org.apache.xerces.internal.dom.TextImpl
implements javax.xml.soap.Text, org.w3c.dom.Text {
@Override
public Text splitText(int offset) throws DOMException {
return textNode.splitText(offset);
}
@Override
public boolean isElementContentWhitespace() {
return textNode.isElementContentWhitespace();
}
@Override
public String getWholeText() {
return textNode.getWholeText();
}
@Override
public Text replaceWholeText(String content) throws DOMException {
return textNode.replaceWholeText(content);
}
@Override
public String getData() throws DOMException {
return textNode.getData();
}
@Override
public void setData(String data) throws DOMException {
textNode.setData(data);
}
@Override
public int getLength() {
return textNode.getLength();
}
@Override
public String substringData(int offset, int count) throws DOMException {
return textNode.substringData(offset, count);
}
@Override
public void appendData(String arg) throws DOMException {
textNode.appendData(arg);
}
@Override
public void insertData(int offset, String arg) throws DOMException {
textNode.insertData(offset, arg);
}
@Override
public void deleteData(int offset, int count) throws DOMException {
textNode.deleteData(offset, count);
}
@Override
public void replaceData(int offset, int count, String arg) throws DOMException {
textNode.replaceData(offset, count, arg);
}
@Override
public String getNodeName() {
return textNode.getNodeName();
}
@Override
public String getNodeValue() throws DOMException {
return textNode.getNodeValue();
}
@Override
public void setNodeValue(String nodeValue) throws DOMException {
textNode.setNodeValue(nodeValue);
}
@Override
public short getNodeType() {
return textNode.getNodeType();
}
@Override
public Node getParentNode() {
return textNode.getParentNode();
}
@Override
public NodeList getChildNodes() {
return textNode.getChildNodes();
}
@Override
public Node getFirstChild() {
return textNode.getFirstChild();
}
@Override
public Node getLastChild() {
return textNode.getLastChild();
}
@Override
public Node getPreviousSibling() {
return textNode.getPreviousSibling();
}
@Override
public Node getNextSibling() {
return textNode.getNextSibling();
}
@Override
public NamedNodeMap getAttributes() {
return textNode.getAttributes();
}
@Override
public Document getOwnerDocument() {
return textNode.getOwnerDocument();
}
@Override
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
return textNode.insertBefore(newChild, refChild);
}
@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
return textNode.replaceChild(newChild, oldChild);
}
@Override
public Node removeChild(Node oldChild) throws DOMException {
return textNode.removeChild(oldChild);
}
@Override
public Node appendChild(Node newChild) throws DOMException {
return textNode.appendChild(newChild);
}
@Override
public boolean hasChildNodes() {
return textNode.hasChildNodes();
}
@Override
public Node cloneNode(boolean deep) {
return textNode.cloneNode(deep);
}
@Override
public void normalize() {
textNode.normalize();
}
@Override
public boolean isSupported(String feature, String version) {
return textNode.isSupported(feature, version);
}
@Override
public String getNamespaceURI() {
return textNode.getNamespaceURI();
}
@Override
public String getPrefix() {
return textNode.getPrefix();
}
@Override
public void setPrefix(String prefix) throws DOMException {
textNode.setPrefix(prefix);
}
@Override
public String getLocalName() {
return textNode.getLocalName();
}
@Override
public boolean hasAttributes() {
return textNode.hasAttributes();
}
@Override
public String getBaseURI() {
return textNode.getBaseURI();
}
@Override
public short compareDocumentPosition(Node other) throws DOMException {
return textNode.compareDocumentPosition(other);
}
@Override
public String getTextContent() throws DOMException {
return textNode.getTextContent();
}
@Override
public void setTextContent(String textContent) throws DOMException {
textNode.setTextContent(textContent);
}
@Override
public boolean isSameNode(Node other) {
return textNode.isSameNode(other);
}
@Override
public String lookupPrefix(String namespaceURI) {
return textNode.lookupPrefix(namespaceURI);
}
@Override
public boolean isDefaultNamespace(String namespaceURI) {
return textNode.isDefaultNamespace(namespaceURI);
}
@Override
public String lookupNamespaceURI(String prefix) {
return textNode.lookupNamespaceURI(prefix);
}
@Override
public boolean isEqualNode(Node arg) {
return textNode.isEqualNode(arg);
}
@Override
public Object getFeature(String feature, String version) {
return textNode.getFeature(feature, version);
}
@Override
public Object setUserData(String key, Object data, UserDataHandler handler) {
return textNode.setUserData(key, data, handler);
}
@Override
public Object getUserData(String key) {
return textNode.getUserData(key);
}
protected static final Logger log =
Logger.getLogger(LogDomainConstants.SOAP_IMPL_DOMAIN,
"com.sun.xml.internal.messaging.saaj.soap.impl.LocalStrings");
private Text textNode;
public SOAPTextImpl(SOAPDocumentImpl ownerDoc, String text) {
super(ownerDoc, text);
textNode = ownerDoc.getDomDocument().createTextNode(text);
ownerDoc.register(this);
}
public String getValue() {
@ -70,7 +324,7 @@ public class SOAPTextImpl
public void detachNode() {
org.w3c.dom.Node parent = getParentNode();
if (parent != null) {
parent.removeChild(this);
parent.removeChild(getDomElement());
}
}
@ -88,4 +342,8 @@ public class SOAPTextImpl
}
return txt.startsWith("<!--") && txt.endsWith("-->");
}
public Text getDomElement() {
return textNode;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -218,6 +218,7 @@ public class NameImpl implements Name {
return prefix + ":" + localName;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Name)) {
return false;
@ -236,6 +237,7 @@ public class NameImpl implements Name {
return true;
}
@Override
public int hashCode() {
return localName.hashCode();
}
@ -245,6 +247,7 @@ public class NameImpl implements Name {
*
* @return a string for the local name.
*/
@Override
public String getLocalName() {
return localName;
}
@ -256,6 +259,7 @@ public class NameImpl implements Name {
*
* @return the prefix as a string.
*/
@Override
public String getPrefix() {
return prefix;
}
@ -265,6 +269,7 @@ public class NameImpl implements Name {
*
* @return the uri as a string.
*/
@Override
public String getURI() {
return uri;
}
@ -272,6 +277,7 @@ public class NameImpl implements Name {
/**
* Returns a String version of the name suitable for use in an XML document.
*/
@Override
public String getQualifiedName() {
if (qualifiedName == null) {
if (prefix != null && prefix.length() > 0) {
@ -285,6 +291,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.1 Envelope.
*
* @param prefix prefix
* @return Envelope Name
*/
public static NameImpl createEnvelope1_1Name(String prefix) {
return new Envelope1_1Name(prefix);
@ -292,6 +301,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.2 Envelope.
*
* @param prefix prefix
* @return Envelope Name
*/
public static NameImpl createEnvelope1_2Name(String prefix) {
return new Envelope1_2Name(prefix);
@ -299,6 +311,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.1 Header.
*
* @param prefix prefix
* @return Header Name
*/
public static NameImpl createHeader1_1Name(String prefix) {
return new Header1_1Name(prefix);
@ -306,6 +321,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.2 Header.
*
* @param prefix prefix
* @return Header Name
*/
public static NameImpl createHeader1_2Name(String prefix) {
return new Header1_2Name(prefix);
@ -313,6 +331,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.1 Body.
*
* @param prefix prefix
* @return Body Name
*/
public static NameImpl createBody1_1Name(String prefix) {
return new Body1_1Name(prefix);
@ -320,6 +341,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.2 Body.
*
* @param prefix prefix
* @return Body Name
*/
public static NameImpl createBody1_2Name(String prefix) {
return new Body1_2Name(prefix);
@ -327,20 +351,29 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.1 Fault.
*
* @param prefix prefix
* @return Fault Name
*/
public static NameImpl createFault1_1Name(String prefix) {
return new Fault1_1Name(prefix);
}
/**
* Create a name object for a SOAP1.2 NotUnderstood element.
*/
* Create a name object for a SOAP1.2 NotUnderstood element.
*
* @param prefix prefix
* @return NotUnderstood Name
*/
public static NameImpl createNotUnderstood1_2Name(String prefix) {
return new NotUnderstood1_2Name(prefix);
}
/**
* Create a name object for a SOAP1.2 Upgrade element.
*
* @param prefix prefix
* @return Upgrade Name
*/
public static NameImpl createUpgrade1_2Name(String prefix) {
return new Upgrade1_2Name(prefix);
@ -348,6 +381,9 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.2 SupportedEnvelope Upgrade element.
*
* @param prefix prefix
* @return Supported Envelope Name
*/
public static NameImpl createSupportedEnvelope1_2Name(String prefix) {
return new SupportedEnvelope1_2Name(prefix);
@ -358,6 +394,8 @@ public class NameImpl implements Name {
* Fault, Reason or Detail.
*
* @param localName Local Name of element
* @param prefix prefix
* @return Fault Name
*/
public static NameImpl createFault1_2Name(
String localName,
@ -369,6 +407,8 @@ public class NameImpl implements Name {
* Create a name object for a SOAP1.2 Fault/Code or Subcode.
*
* @param localName Either "Code" or "Subcode"
* @param prefix prefix
* @return CodeSubcode Name
*/
public static NameImpl createCodeSubcode1_2Name(
String prefix,
@ -378,6 +418,8 @@ public class NameImpl implements Name {
/**
* Create a name object for a SOAP1.1 Fault Detail.
*
* @return Detail Name
*/
public static NameImpl createDetail1_1Name() {
return new Detail1_1Name();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -38,12 +38,17 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.BodyImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public class Body1_1Impl extends BodyImpl {
public Body1_1Impl(SOAPDocumentImpl ownerDocument, String prefix) {
super(ownerDocument, NameImpl.createBody1_1Name(prefix));
}
public Body1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
public SOAPFault addSOAP12Fault(QName faultCode, String faultReason, Locale locale) {
// log message here
throw new UnsupportedOperationException("Not supported in SOAP 1.1");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -36,6 +36,7 @@ import javax.xml.soap.Name;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.DetailImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public class Detail1_1Impl extends DetailImpl {
@ -45,6 +46,11 @@ public class Detail1_1Impl extends DetailImpl {
public Detail1_1Impl(SOAPDocumentImpl ownerDoc) {
super(ownerDoc, NameImpl.createDetail1_1Name());
}
public Detail1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected DetailEntry createDetailEntry(Name name) {
return new DetailEntry1_1Impl(
(SOAPDocumentImpl) getOwnerDocument(),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -34,6 +34,7 @@ import javax.xml.soap.SOAPException;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public class Envelope1_1Impl extends EnvelopeImpl {
@ -52,6 +53,11 @@ public class Envelope1_1Impl extends EnvelopeImpl {
createHeader,
createBody);
}
public Envelope1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected NameImpl getBodyName(String prefix) {
return NameImpl.createBody1_1Name(prefix);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -46,6 +46,7 @@ import com.sun.xml.internal.messaging.saaj.soap.impl.*;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import org.w3c.dom.Element;
public class Fault1_1Impl extends FaultImpl {
@ -59,6 +60,10 @@ public class Fault1_1Impl extends FaultImpl {
super(ownerDocument, NameImpl.createFault1_1Name(prefix));
}
public Fault1_1Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
super(ownerDoc, domElement);
}
protected NameImpl getDetailName() {
return NameImpl.createDetail1_1Name();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -40,6 +40,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import org.w3c.dom.Element;
public class Header1_1Impl extends HeaderImpl {
@ -51,6 +52,10 @@ public class Header1_1Impl extends HeaderImpl {
super(ownerDocument, NameImpl.createHeader1_1Name(prefix));
}
public Header1_1Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected NameImpl getNotUnderstoodName() {
log.log(
Level.SEVERE,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -34,6 +34,7 @@ import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.soap.*;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
@ -52,6 +53,10 @@ public class Body1_2Impl extends BodyImpl {
super(ownerDocument, NameImpl.createBody1_2Name(prefix));
}
public Body1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected NameImpl getFaultName(String name) {
return NameImpl.createFault1_2Name(name, null);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -39,6 +39,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.DetailImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public class Detail1_2Impl extends DetailImpl {
@ -54,6 +55,10 @@ public class Detail1_2Impl extends DetailImpl {
super(ownerDocument, NameImpl.createSOAP12Name("Detail"));
}
public Detail1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected DetailEntry createDetailEntry(Name name) {
return new DetailEntry1_2Impl(
((SOAPDocument) getOwnerDocument()).getDocument(),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -39,6 +39,7 @@ import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import org.w3c.dom.Element;
public class Envelope1_2Impl extends EnvelopeImpl {
@ -50,6 +51,10 @@ public class Envelope1_2Impl extends EnvelopeImpl {
super(ownerDoc, NameImpl.createEnvelope1_2Name(prefix));
}
public Envelope1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
public Envelope1_2Impl(
SOAPDocumentImpl ownerDoc,
String prefix,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -42,6 +42,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.*;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import org.w3c.dom.Element;
public class Fault1_2Impl extends FaultImpl {
@ -68,6 +69,10 @@ public class Fault1_2Impl extends FaultImpl {
super(ownerDocument, NameImpl.createFault1_2Name(null, prefix));
}
public Fault1_2Impl(Element domElement, SOAPDocumentImpl ownerDoc) {
super(ownerDoc, domElement);
}
protected NameImpl getDetailName() {
return NameImpl.createSOAP12Name("Detail", getPrefix());
}
@ -521,7 +526,7 @@ public class Fault1_2Impl extends FaultImpl {
}
}
if (element instanceof Detail1_2Impl) {
ElementImpl importedElement = (ElementImpl) importElement(element);
Element importedElement = importElement(element);
addNode(importedElement);
return convertToSoapElement(importedElement);
} else

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -41,6 +41,7 @@ import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl;
import com.sun.xml.internal.messaging.saaj.soap.impl.HeaderImpl;
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
import org.w3c.dom.Element;
public class Header1_2Impl extends HeaderImpl {
@ -54,6 +55,10 @@ public class Header1_2Impl extends HeaderImpl {
super(ownerDocument, NameImpl.createHeader1_2Name(prefix));
}
public Header1_2Impl(SOAPDocumentImpl ownerDoc, Element domElement) {
super(ownerDoc, domElement);
}
protected NameImpl getNotUnderstoodName() {
return NameImpl.createNotUnderstood1_2Name(null);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -37,7 +37,6 @@ package com.sun.xml.internal.messaging.saaj.util;
* This class is used by XML Schema binary format validation
*
* @author Jeffrey Rodriguez
* @version
*/
public final class Base64 {
@ -173,7 +172,7 @@ public final class Base64 {
/**
* Decodes Base64 data into octects
*
* @param binaryData Byte array containing Base64 data
* @param base64Data Byte array containing Base64 data
* @return Array containind decoded data.
*/
public byte[] decode( byte[] base64Data ) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -42,6 +42,7 @@ import java.io.ByteArrayInputStream;
* <li>doesn't do synchronization
* <li>allows access to the raw buffer
* <li>almost no parameter check
* </ol>
*/
public final class ByteOutputStream extends OutputStream {
/**
@ -64,6 +65,9 @@ public final class ByteOutputStream extends OutputStream {
/**
* Copies all the bytes from this input into this buffer.
*
* @param in input stream.
* @exception IOException in case of an I/O error.
*/
public void write(InputStream in) throws IOException {
if (in instanceof ByteArrayInputStream) {
@ -84,6 +88,7 @@ public final class ByteOutputStream extends OutputStream {
}
}
@Override
public void write(int b) {
ensureCapacity(1);
buf[count] = (byte) b;
@ -102,18 +107,22 @@ public final class ByteOutputStream extends OutputStream {
}
}
@Override
public void write(byte[] b, int off, int len) {
ensureCapacity(len);
System.arraycopy(b, off, buf, count, len);
count += len;
}
@Override
public void write(byte[] b) {
write(b, 0, b.length);
}
/**
* Writes a string as ASCII string.
*
* @param s string to write.
*/
public void writeAsAscii(String s) {
int len = s.length();
@ -138,9 +147,12 @@ public final class ByteOutputStream extends OutputStream {
* Evil buffer reallocation method.
* Don't use it unless you absolutely have to.
*
* @return byte array
*
* @deprecated
* because this is evil!
*/
@Deprecated
public byte toByteArray()[] {
byte[] newbuf = new byte[count];
System.arraycopy(buf, 0, newbuf, 0, count);
@ -162,10 +174,12 @@ public final class ByteOutputStream extends OutputStream {
* @return String translated from the buffer's contents.
* @since JDK1.1
*/
@Override
public String toString() {
return new String(buf, 0, count);
}
@Override
public void close() {
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, 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
@ -39,8 +39,9 @@ import java.io.Serializable;
* string and fragment) that may constitute a URI.
* <p>
* Parsing of a URI specification is done according to the URI
* syntax described in <a href="http://www.ietf.org/rfc/rfc2396.txt?number=2396">RFC 2396</a>.
* Every URI consists of a scheme, followed by a colon (':'), followed by a scheme-specific
* syntax described in <a href="http://www.ietf.org/rfc/rfc2396.txt?number=2396">
* RFC 2396</a>. Every URI consists
* of a scheme, followed by a colon (':'), followed by a scheme-specific
* part. For URIs that follow the "generic URI" syntax, the scheme-
* specific part begins with two slashes ("//") and may be followed
* by an authority segment (comprised of user information, host, and
@ -60,8 +61,6 @@ import java.io.Serializable;
* default port for a specific scheme). Rather, it only knows the
* grammar and basic set of operations that can be applied to a URI.
*
* @version
*
**********************************************************************/
public class JaxmURI implements Serializable {
@ -1106,6 +1105,7 @@ import java.io.Serializable;
* @return true if p_test is a URI with all values equal to this
* URI, false otherwise
*/
@Override
public boolean equals(Object p_test) {
if (p_test instanceof JaxmURI) {
JaxmURI testURI = (JaxmURI) p_test;
@ -1134,6 +1134,7 @@ import java.io.Serializable;
return false;
}
@Override
public int hashCode() {
// No members safe to use, just default to a constant.
return 153214;
@ -1144,6 +1145,7 @@ import java.io.Serializable;
*
* @return the URI string specification
*/
@Override
public String toString() {
StringBuilder uriSpecString = new StringBuilder();
@ -1173,6 +1175,8 @@ import java.io.Serializable;
* A scheme is conformant if it starts with an alphanumeric, and
* contains only alphanumerics, '+','-' and '.'.
*
* @param p_scheme scheme name
*
* @return true if the scheme is conformant, false otherwise
*/
public static boolean isConformantSchemeName(String p_scheme) {
@ -1202,7 +1206,9 @@ import java.io.Serializable;
* IPv4 address consists of four decimal digit groups separated by a
* '.'. A hostname consists of domain labels (each of which must
* begin and end with an alphanumeric but may contain '-') separated
& by a '.'. See RFC 2396 Section 3.2.2.
* by a '.'. See RFC 2396 Section 3.2.2.
*
* @param p_address address
*
* @return true if the string is a syntactically valid IPv4 address
* or hostname

Some files were not shown because too many files have changed in this diff Show More