# HG changeset patch # User coffeys # Date 1421860089 0 # Node ID 7a0dacd12a9e42f581c11edeb51a69af9a8ab16d # Parent dd25f8e8c6abda4a030076063824bc59bc2e0d28# Parent 6e928fd9152541eddf25694be89eb881434a5c5f Merge diff -r dd25f8e8c6ab -r 7a0dacd12a9e .hgtags --- a/.hgtags Wed Dec 17 14:46:36 2014 -0800 +++ b/.hgtags Wed Jan 21 17:08:09 2015 +0000 @@ -312,6 +312,8 @@ 1277c0d492fd9253f1ea2730eb160953397bd939 jdk8u20-b24 1277c0d492fd9253f1ea2730eb160953397bd939 jdk8u20-b25 7025a2c10ea4116ce8f31bb1e305f732aa1025f0 jdk8u20-b26 +7053deda0ffd69046ef480b3595cf13451b477ec jdk8u20-b31 +2f39063fee48f96fe9cacf704ce30c6fc333ae73 jdk8u20-b32 efc85d318f4697f40bdd1f3757677be97f1758d9 jdk8u25-b00 a76779e1b0376650dfc29a1f3b14760f05e0fc6d jdk8u25-b01 3d31955043b9f1807c9d695c7b5d604d11c132cf jdk8u25-b02 @@ -331,6 +333,21 @@ 4570a7d00aa9bd3df028f52d6f9d8c434163b689 jdk8u25-b16 d47a47f961ee423ce03623098f62d79254c6f328 jdk8u25-b17 cb0ad90bfe3c497c7236c5480447c4bde110934f jdk8u25-b18 +a345282d661be80f2cdee3c43e12fbe01e7ff6d5 jdk8u25-b31 +3a676fe898c93ad3afcaa55a71da96455e5f230e jdk8u31-b00 +1c73ca9179f22d4a73d1a248a3254f891c71ee30 jdk8u31-b01 +c1f1ed28e0bb68d7536fb30bb6f1a3623816b12a jdk8u31-b02 +31893650acaf8935ad395d04cbc1575bada97622 jdk8u31-b03 +60ee8e1e63aee861ea7606c5825c15209bb10aa2 jdk8u31-b04 +e4e3070ba39416ea1f20a6583276117c5498466f jdk8u31-b05 +90cd67a6b6e5e4db93155cc0260a94b55b35bc74 jdk8u31-b06 +06807f9a68358f9684ab59b249760ba2b47cc07b jdk8u31-b07 +45193c5ae26d67cd3dc6961506d8c06803ff646c jdk8u31-b08 +9a310a2276f9a01822b3cfc91268a67cbaaafd0a jdk8u31-b09 +dd0467f3fe130884849ad8fb226d76f02b4cbde4 jdk8u31-b10 +497c783d228ed188d61964edd409794af3ad3e5c jdk8u31-b11 +959e8fca46155528c8147da69a7c49edfb002cb1 jdk8u31-b12 +9d0c737694ece23547c0a27dcd0ba6cbcdf577f2 jdk8u31-b13 31d43d250c836c13fcc87025837783788c5cd0de jdk8u40-b00 262fb5353ffa661f88b4a9cf2581fcad8c2a43f7 jdk8u40-b01 8043f77ef8a4ded9505269a356c4e2f4f9604cd9 jdk8u40-b02 @@ -351,4 +368,6 @@ 83c4d5aca2ff8fd0c6b2a7091018b71313371176 jdk8u40-b17 fa07311627d085f1307f55298f59463bcf55db02 jdk8u40-b18 c8b402c28fe51e25f3298e1266f2ae48bda8d3e0 jdk8u40-b19 +a21c4edfdf4402f027183ac8c8aac2db49df3b7d jdk8u40-b20 +16485a38b6bc762b363f4e439047486742fbcfcb jdk8u40-b21 c8b402c28fe51e25f3298e1266f2ae48bda8d3e0 jdk8u60-b00 diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java Wed Jan 21 17:08:09 2015 +0000 @@ -43,6 +43,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -197,7 +199,15 @@ static { - QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { + String MAP_ANYURI_TO_URI_VALUE = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public String run() { + return System.getProperty(MAP_ANYURI_TO_URI); + } + } + ); + QName[] qnames = (MAP_ANYURI_TO_URI_VALUE == null) ? new QName[] { createXS("string"), createXS("anySimpleType"), createXS("normalizedString"), @@ -310,7 +320,7 @@ return v.toExternalForm(); } }); - if (System.getProperty(MAP_ANYURI_TO_URI) == null) { + if (MAP_ANYURI_TO_URI_VALUE == null) { secondaryList.add( new StringImpl(URI.class, createXS("string")) { public URI parse(CharSequence text) throws SAXException { @@ -774,17 +784,18 @@ } }); primaryList.add( - new StringImpl(BigDecimal.class, - createXS("decimal") + new StringImpl(BigDecimal.class, + createXS("decimal") ) { - public BigDecimal parse(CharSequence text) { - return DatatypeConverterImpl._parseDecimal(text.toString()); + public BigDecimal parse(CharSequence text) { + return DatatypeConverterImpl._parseDecimal(text.toString()); + } + + public String print(BigDecimal v) { + return DatatypeConverterImpl._printDecimal(v); + } } - - public String print(BigDecimal v) { - return DatatypeConverterImpl._printDecimal(v); - } - }); + ); primaryList.add( new StringImpl(QName.class, createXS("QName") @@ -812,7 +823,7 @@ w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false); } }); - if (System.getProperty(MAP_ANYURI_TO_URI) != null) { + if (MAP_ANYURI_TO_URI_VALUE != null) { primaryList.add( new StringImpl(URI.class, createXS("anyURI")) { public URI parse(CharSequence text) throws SAXException { @@ -830,16 +841,17 @@ }); } primaryList.add( - new StringImpl(Duration.class, createXS("duration")) { - public String print(Duration duration) { - return duration.toString(); + new StringImpl(Duration.class, createXS("duration")) { + public String print(Duration duration) { + return duration.toString(); + } + + public Duration parse(CharSequence lexical) { + TODO.checkSpec("JSR222 Issue #42"); + return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); + } } - - public Duration parse(CharSequence lexical) { - TODO.checkSpec("JSR222 Issue #42"); - return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); - } - }); + ); primaryList.add( new StringImpl(Void.class) { // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -38,6 +38,9 @@ /** * Utils class. + * + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. + * * Has *package private* access to avoid inappropriate usage. */ final class Utils { @@ -51,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -69,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java Wed Jan 21 17:08:09 2015 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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,8 +25,10 @@ package com.sun.xml.internal.bind.v2.util; -import com.sun.xml.internal.bind.Util; import com.sun.xml.internal.bind.v2.Messages; + +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.XMLConstants; @@ -43,8 +45,6 @@ import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; -import static com.sun.xml.internal.bind.Util.getSystemProperty; - /** * Provides helper methods for creating properly configured XML parser * factory instances with namespace support turned on and configured for @@ -68,7 +68,14 @@ */ private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity"; - public static final boolean XML_SECURITY_DISABLED = Boolean.parseBoolean(getSystemProperty(DISABLE_XML_SECURITY)); + private static final boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Boolean run() { + return Boolean.getBoolean(DISABLE_XML_SECURITY); + } + } + ); private static boolean isXMLSecurityDisabled(boolean runtimeSetting) { return XML_SECURITY_DISABLED || runtimeSetting; diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -54,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -72,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Wed Jan 21 17:08:09 2015 +0000 @@ -147,19 +147,12 @@ } public EndpointReference readEndpointReference(final Source eprInfoset) { - // EPR constructors are private, so we need privilege escalation. - // this unmarshalling can only access instances of a fixed, known set of classes, - // so doing that shouldn't introduce security vulnerability. - return AccessController.doPrivileged(new PrivilegedAction() { - public EndpointReference run() { - try { - Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); - return (EndpointReference) unmarshaller.unmarshal(eprInfoset); - } catch (JAXBException e) { - throw new WebServiceException("Error creating Marshaller or marshalling.", e); - } - } - }); + try { + Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); + return (EndpointReference) unmarshaller.unmarshal(eprInfoset); + } catch (JAXBException e) { + throw new WebServiceException("Error creating Marshaller or marshalling.", e); + } } public T getPort(EndpointReference endpointReference, Class clazz, WebServiceFeature... webServiceFeatures) { diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Wed Jan 21 17:08:09 2015 +0000 @@ -54,17 +54,20 @@ static { // we statically initializing REFLECTION_NAVIGATOR property try { - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - //noinspection unchecked - final Method getInstance = refNav.getDeclaredMethod("getInstance"); + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); // requires accessClassInPackage privilege - AccessController.doPrivileged( - new PrivilegedAction() { + final Method getInstance = AccessController.doPrivileged( + new PrivilegedAction() { @Override - public Object run() { - getInstance.setAccessible(true); - return null; + public Method run() { + try { + Method getInstance = refNav.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + return getInstance; + } catch (NoSuchMethodException e) { + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); + } } } ); @@ -72,16 +75,10 @@ //noinspection unchecked REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); } catch (ClassNotFoundException e) { - e.printStackTrace(); throw new IllegalStateException("Can't find ReflectionNavigator class"); } catch (InvocationTargetException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); } catch (IllegalAccessException e) { - e.printStackTrace(); throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); } catch (SecurityException e) { LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); diff -r dd25f8e8c6ab -r 7a0dacd12a9e src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Wed Dec 17 14:46:36 2014 -0800 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Wed Jan 21 17:08:09 2015 +0000 @@ -63,6 +63,8 @@ import java.io.OutputStreamWriter; import java.io.Writer; import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; @@ -84,12 +86,16 @@ private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName()); - private static boolean XML_SECURITY_DISABLED; + private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity"; - static { - String disableXmlSecurity = System.getProperty("com.sun.xml.internal.ws.disableXmlSecurity"); - XML_SECURITY_DISABLED = disableXmlSecurity == null || !Boolean.valueOf(disableXmlSecurity); - } + private static boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( + new PrivilegedAction() { + @Override + public Boolean run() { + return Boolean.getBoolean(DISABLE_XML_SECURITY); + } + } + ); public static String getPrefix(String s) { int i = s.indexOf(':');