diff options
author | mkos <none@none> | 2013-06-12 14:47:09 +0100 |
---|---|---|
committer | mkos <none@none> | 2013-06-12 14:47:09 +0100 |
commit | 0c0f7ad31630f1c2da67fbeb8c71af34047ee5c2 (patch) | |
tree | 0e48efda9fb420ceec85d151c2c17058b95fc642 /src/share/jaxws_classes/javax | |
parent | b722ec820281a56a1b4921d9e8b1bbcec2aa9e59 (diff) | |
download | jdk8u_jaxws-0c0f7ad31630f1c2da67fbeb8c71af34047ee5c2.tar.gz |
8013021: Rebase 8005432 & 8003542 against the latest jdk8/jaxws
8003542: Improve processing of MTOM attachments
8005432: Update access to JAX-WS
Reviewed-by: mullan
Diffstat (limited to 'src/share/jaxws_classes/javax')
5 files changed, 52 insertions, 44 deletions
diff --git a/src/share/jaxws_classes/javax/xml/soap/FactoryFinder.java b/src/share/jaxws_classes/javax/xml/soap/FactoryFinder.java index d1b240c4..391c1eea 100644 --- a/src/share/jaxws_classes/javax/xml/soap/FactoryFinder.java +++ b/src/share/jaxws_classes/javax/xml/soap/FactoryFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,20 +39,17 @@ class FactoryFinder { * or could not be instantiated */ private static Object newInstance(String className, - ClassLoader classLoader, - String defaultFactoryClass) - throws SOAPException + ClassLoader classLoader) + throws SOAPException { try { - Class spiClass = safeLoadClass(className, classLoader, defaultFactoryClass); + Class spiClass = safeLoadClass(className, classLoader); return spiClass.newInstance(); + } catch (ClassNotFoundException x) { - throw new SOAPException( - "Provider " + className + " not found", x); + throw new SOAPException("Provider " + className + " not found", x); } catch (Exception x) { - throw new SOAPException( - "Provider " + className + " could not be instantiated: " + x, - x); + throw new SOAPException("Provider " + className + " could not be instantiated: " + x, x); } } @@ -70,7 +67,7 @@ class FactoryFinder { * @exception SOAPException if there is a SOAP error */ static Object find(String factoryId) - throws SOAPException + throws SOAPException { return find(factoryId, null, false); } @@ -85,7 +82,7 @@ class FactoryFinder { * This method is package private so that this code can be shared. * * @return the <code>Class</code> object of the specified message factory; - * may not be <code>null</code> + * may be <code>null</code> * * @param factoryId the name of the factory to find, which is * a system property @@ -96,7 +93,7 @@ class FactoryFinder { * @exception SOAPException if there is a SOAP error */ static Object find(String factoryId, String fallbackClassName) - throws SOAPException + throws SOAPException { return find(factoryId, fallbackClassName, true); } @@ -108,7 +105,7 @@ class FactoryFinder { * is <code>true</code>. The arguments supplied must be used in order * If using the first argument is successful, the second one will not * be used. Note the default class name may be needed even if fallback - * is not to be attempted, so certain error condiitons can be handled. + * is not to be attempted, so certain error conditions can be handled. * <P> * This method is package private so that this code can be shared. * @@ -126,7 +123,7 @@ class FactoryFinder { * @exception SOAPException if there is a SOAP error */ static Object find(String factoryId, String defaultClassName, - boolean tryFallback) throws SOAPException { + boolean tryFallback) throws SOAPException { ClassLoader classLoader; try { classLoader = Thread.currentThread().getContextClassLoader(); @@ -137,9 +134,9 @@ class FactoryFinder { // Use the system property first try { String systemProp = - System.getProperty( factoryId ); + System.getProperty( factoryId ); if( systemProp!=null) { - return newInstance(systemProp, classLoader, defaultClassName); + return newInstance(systemProp, classLoader); } } catch (SecurityException se) { } @@ -148,13 +145,13 @@ class FactoryFinder { try { String javah=System.getProperty( "java.home" ); String configFile = javah + File.separator + - "lib" + File.separator + "jaxm.properties"; + "lib" + File.separator + "jaxm.properties"; File f=new File( configFile ); if( f.exists()) { Properties props=new Properties(); props.load( new FileInputStream(f)); String factoryClassName = props.getProperty(factoryId); - return newInstance(factoryClassName, classLoader, defaultClassName); + return newInstance(factoryClassName, classLoader); } } catch(Exception ex ) { } @@ -171,14 +168,14 @@ class FactoryFinder { if( is!=null ) { BufferedReader rd = - new BufferedReader(new InputStreamReader(is, "UTF-8")); + new BufferedReader(new InputStreamReader(is, "UTF-8")); String factoryClassName = rd.readLine(); rd.close(); if (factoryClassName != null && - ! "".equals(factoryClassName)) { - return newInstance(factoryClassName, classLoader, defaultClassName); + ! "".equals(factoryClassName)) { + return newInstance(factoryClassName, classLoader); } } } catch( Exception ex ) { @@ -192,9 +189,9 @@ class FactoryFinder { // (built in) factory if specified. if (defaultClassName == null) { throw new SOAPException( - "Provider for " + factoryId + " cannot be found", null); + "Provider for " + factoryId + " cannot be found", null); } - return newInstance(defaultClassName, classLoader, defaultClassName); + return newInstance(defaultClassName, classLoader); } /** @@ -204,7 +201,7 @@ class FactoryFinder { * Class.forName() on it so it will be loaded by the bootstrap class loader. */ private static Class safeLoadClass(String className, - ClassLoader classLoader, String defaultFactoryClass) + ClassLoader classLoader) throws ClassNotFoundException { try { // make sure that the current thread has an access to the package of the given name. @@ -221,12 +218,19 @@ class FactoryFinder { else return classLoader.loadClass(className); } catch (SecurityException se) { - // The FactoryFinder is in the bootstrap class loader, so - // the following should work, but we only attempt it - // if it the the default class. - if (className.equals(defaultFactoryClass)) + // (only) default implementation can be loaded + // using bootstrap class loader: + if (isDefaultImplementation(className)) return Class.forName(className); + throw se; } } + + private static boolean isDefaultImplementation(String className) { + return MessageFactory.DEFAULT_MESSAGE_FACTORY.equals(className) || + SOAPFactory.DEFAULT_SOAP_FACTORY.equals(className) || + SOAPConnectionFactory.DEFAULT_SOAP_CONNECTION_FACTORY.equals(className) || + SAAJMetaFactory.DEFAULT_META_FACTORY_CLASS.equals(className); + } } diff --git a/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java b/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java index 663ff51b..074c7207 100644 --- a/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java +++ b/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ import java.io.InputStream; */ public abstract class MessageFactory { - static private final String DEFAULT_MESSAGE_FACTORY + static final String DEFAULT_MESSAGE_FACTORY = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"; static private final String MESSAGE_FACTORY_PROPERTY @@ -96,16 +96,22 @@ public abstract class MessageFactory { * @see SAAJMetaFactory */ - public static MessageFactory newInstance() - throws SOAPException { + public static MessageFactory newInstance() throws SOAPException { + + try { - MessageFactory factory = (MessageFactory) + MessageFactory factory = (MessageFactory) FactoryFinder.find( + MESSAGE_FACTORY_PROPERTY, + DEFAULT_MESSAGE_FACTORY, + false); FactoryFinder.find(MESSAGE_FACTORY_PROPERTY, DEFAULT_MESSAGE_FACTORY, false); - if (factory != null) + if (factory != null) { return factory; + } return newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); + } catch (Exception ex) { throw new SOAPException( "Unable to create message factory for SOAP: " diff --git a/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java b/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java index f021c13d..e7fcf813 100644 --- a/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java +++ b/src/share/jaxws_classes/javax/xml/soap/SAAJMetaFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ package javax.xml.soap; public abstract class SAAJMetaFactory { static private final String META_FACTORY_CLASS_PROPERTY = "javax.xml.soap.MetaFactory"; - static private final String DEFAULT_META_FACTORY_CLASS = + static final String DEFAULT_META_FACTORY_CLASS = "com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl"; /** diff --git a/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java b/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java index e9335d4a..c1e51f09 100644 --- a/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java +++ b/src/share/jaxws_classes/javax/xml/soap/SOAPConnectionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ public abstract class SOAPConnectionFactory { * A constant representing the default value for a <code>SOAPConnection</code> * object. The default is the point-to-point SOAP connection. */ - static private final String DEFAULT_SOAP_CONNECTION_FACTORY + static final String DEFAULT_SOAP_CONNECTION_FACTORY = "com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory"; /** diff --git a/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java b/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java index 1d49f891..5f8778e7 100644 --- a/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java +++ b/src/share/jaxws_classes/javax/xml/soap/SOAPFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,11 +54,9 @@ public abstract class SOAPFactory { "javax.xml.soap.SOAPFactory"; /** - * A constant representing the name of the default <code>SOAPFactory</code> - * factory class to be used if another cannot be found. - * a <code>SOAPFactory</code> implementation class. + * Class name of default <code>SOAPFactory</code> implementation. */ - static private final String DEFAULT_SOAP_FACTORY + static final String DEFAULT_SOAP_FACTORY = "com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl"; /** |