Fri, 24 Oct 2014 15:02:28 +0200
8054367: More references for endpoints
Summary: fix also reviewed by Iaroslav.Savytskyi@oracle.com, Alexander.Fomin@oracle.com
Reviewed-by: mullan, skoivu
1.1 --- a/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Mon Oct 27 12:57:38 2014 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Fri Oct 24 15:02:28 2014 +0200 1.3 @@ -38,6 +38,9 @@ 1.4 1.5 /** 1.6 * Utils class. 1.7 + * 1.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 1.9 + * 1.10 * Has *package private* access to avoid inappropriate usage. 1.11 */ 1.12 final class Utils { 1.13 @@ -51,17 +54,20 @@ 1.14 1.15 static { // we statically initializing REFLECTION_NAVIGATOR property 1.16 try { 1.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 1.18 - //noinspection unchecked 1.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 1.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 1.21 1.22 // requires accessClassInPackage privilege 1.23 - AccessController.doPrivileged( 1.24 - new PrivilegedAction<Object>() { 1.25 + final Method getInstance = AccessController.doPrivileged( 1.26 + new PrivilegedAction<Method>() { 1.27 @Override 1.28 - public Object run() { 1.29 - getInstance.setAccessible(true); 1.30 - return null; 1.31 + public Method run() { 1.32 + try { 1.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 1.34 + getInstance.setAccessible(true); 1.35 + return getInstance; 1.36 + } catch (NoSuchMethodException e) { 1.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 1.38 + } 1.39 } 1.40 } 1.41 ); 1.42 @@ -69,16 +75,10 @@ 1.43 //noinspection unchecked 1.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 1.45 } catch (ClassNotFoundException e) { 1.46 - e.printStackTrace(); 1.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 1.48 } catch (InvocationTargetException e) { 1.49 - e.printStackTrace(); 1.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 1.51 - } catch (NoSuchMethodException e) { 1.52 - e.printStackTrace(); 1.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 1.54 } catch (IllegalAccessException e) { 1.55 - e.printStackTrace(); 1.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 1.57 } catch (SecurityException e) { 1.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
2.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Mon Oct 27 12:57:38 2014 -0700 2.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Fri Oct 24 15:02:28 2014 +0200 2.3 @@ -38,6 +38,9 @@ 2.4 2.5 /** 2.6 * Utils class. 2.7 + * 2.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 2.9 + * 2.10 * Has *package private* access to avoid inappropriate usage. 2.11 */ 2.12 final class Utils { 2.13 @@ -51,17 +54,20 @@ 2.14 2.15 static { // we statically initializing REFLECTION_NAVIGATOR property 2.16 try { 2.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 2.18 - //noinspection unchecked 2.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 2.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 2.21 2.22 // requires accessClassInPackage privilege 2.23 - AccessController.doPrivileged( 2.24 - new PrivilegedAction<Object>() { 2.25 + final Method getInstance = AccessController.doPrivileged( 2.26 + new PrivilegedAction<Method>() { 2.27 @Override 2.28 - public Object run() { 2.29 - getInstance.setAccessible(true); 2.30 - return null; 2.31 + public Method run() { 2.32 + try { 2.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 2.34 + getInstance.setAccessible(true); 2.35 + return getInstance; 2.36 + } catch (NoSuchMethodException e) { 2.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 2.38 + } 2.39 } 2.40 } 2.41 ); 2.42 @@ -69,16 +75,10 @@ 2.43 //noinspection unchecked 2.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 2.45 } catch (ClassNotFoundException e) { 2.46 - e.printStackTrace(); 2.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 2.48 } catch (InvocationTargetException e) { 2.49 - e.printStackTrace(); 2.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 2.51 - } catch (NoSuchMethodException e) { 2.52 - e.printStackTrace(); 2.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 2.54 } catch (IllegalAccessException e) { 2.55 - e.printStackTrace(); 2.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 2.57 } catch (SecurityException e) { 2.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
3.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java Mon Oct 27 12:57:38 2014 -0700 3.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java Fri Oct 24 15:02:28 2014 +0200 3.3 @@ -43,6 +43,8 @@ 3.4 import java.net.URI; 3.5 import java.net.URISyntaxException; 3.6 import java.net.URL; 3.7 +import java.security.AccessController; 3.8 +import java.security.PrivilegedAction; 3.9 import java.util.ArrayList; 3.10 import java.util.Calendar; 3.11 import java.util.Collections; 3.12 @@ -197,7 +199,15 @@ 3.13 3.14 static { 3.15 3.16 - QName[] qnames = (System.getProperty(MAP_ANYURI_TO_URI) == null) ? new QName[] { 3.17 + String MAP_ANYURI_TO_URI_VALUE = AccessController.doPrivileged( 3.18 + new PrivilegedAction<String>() { 3.19 + @Override 3.20 + public String run() { 3.21 + return System.getProperty(MAP_ANYURI_TO_URI); 3.22 + } 3.23 + } 3.24 + ); 3.25 + QName[] qnames = (MAP_ANYURI_TO_URI_VALUE == null) ? new QName[] { 3.26 createXS("string"), 3.27 createXS("anySimpleType"), 3.28 createXS("normalizedString"), 3.29 @@ -310,7 +320,7 @@ 3.30 return v.toExternalForm(); 3.31 } 3.32 }); 3.33 - if (System.getProperty(MAP_ANYURI_TO_URI) == null) { 3.34 + if (MAP_ANYURI_TO_URI_VALUE == null) { 3.35 secondaryList.add( 3.36 new StringImpl<URI>(URI.class, createXS("string")) { 3.37 public URI parse(CharSequence text) throws SAXException { 3.38 @@ -774,17 +784,18 @@ 3.39 } 3.40 }); 3.41 primaryList.add( 3.42 - new StringImpl<BigDecimal>(BigDecimal.class, 3.43 - createXS("decimal") 3.44 + new StringImpl<BigDecimal>(BigDecimal.class, 3.45 + createXS("decimal") 3.46 ) { 3.47 - public BigDecimal parse(CharSequence text) { 3.48 - return DatatypeConverterImpl._parseDecimal(text.toString()); 3.49 + public BigDecimal parse(CharSequence text) { 3.50 + return DatatypeConverterImpl._parseDecimal(text.toString()); 3.51 + } 3.52 + 3.53 + public String print(BigDecimal v) { 3.54 + return DatatypeConverterImpl._printDecimal(v); 3.55 + } 3.56 } 3.57 - 3.58 - public String print(BigDecimal v) { 3.59 - return DatatypeConverterImpl._printDecimal(v); 3.60 - } 3.61 - }); 3.62 + ); 3.63 primaryList.add( 3.64 new StringImpl<QName>(QName.class, 3.65 createXS("QName") 3.66 @@ -812,7 +823,7 @@ 3.67 w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false); 3.68 } 3.69 }); 3.70 - if (System.getProperty(MAP_ANYURI_TO_URI) != null) { 3.71 + if (MAP_ANYURI_TO_URI_VALUE != null) { 3.72 primaryList.add( 3.73 new StringImpl<URI>(URI.class, createXS("anyURI")) { 3.74 public URI parse(CharSequence text) throws SAXException { 3.75 @@ -830,16 +841,17 @@ 3.76 }); 3.77 } 3.78 primaryList.add( 3.79 - new StringImpl<Duration>(Duration.class, createXS("duration")) { 3.80 - public String print(Duration duration) { 3.81 - return duration.toString(); 3.82 + new StringImpl<Duration>(Duration.class, createXS("duration")) { 3.83 + public String print(Duration duration) { 3.84 + return duration.toString(); 3.85 + } 3.86 + 3.87 + public Duration parse(CharSequence lexical) { 3.88 + TODO.checkSpec("JSR222 Issue #42"); 3.89 + return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); 3.90 + } 3.91 } 3.92 - 3.93 - public Duration parse(CharSequence lexical) { 3.94 - TODO.checkSpec("JSR222 Issue #42"); 3.95 - return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); 3.96 - } 3.97 - }); 3.98 + ); 3.99 primaryList.add( 3.100 new StringImpl<Void>(Void.class) { 3.101 // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined
4.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Mon Oct 27 12:57:38 2014 -0700 4.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Fri Oct 24 15:02:28 2014 +0200 4.3 @@ -38,6 +38,9 @@ 4.4 4.5 /** 4.6 * Utils class. 4.7 + * 4.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 4.9 + * 4.10 * Has *package private* access to avoid inappropriate usage. 4.11 */ 4.12 final class Utils { 4.13 @@ -51,17 +54,20 @@ 4.14 4.15 static { // we statically initializing REFLECTION_NAVIGATOR property 4.16 try { 4.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 4.18 - //noinspection unchecked 4.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 4.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 4.21 4.22 // requires accessClassInPackage privilege 4.23 - AccessController.doPrivileged( 4.24 - new PrivilegedAction<Object>() { 4.25 + final Method getInstance = AccessController.doPrivileged( 4.26 + new PrivilegedAction<Method>() { 4.27 @Override 4.28 - public Object run() { 4.29 - getInstance.setAccessible(true); 4.30 - return null; 4.31 + public Method run() { 4.32 + try { 4.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 4.34 + getInstance.setAccessible(true); 4.35 + return getInstance; 4.36 + } catch (NoSuchMethodException e) { 4.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 4.38 + } 4.39 } 4.40 } 4.41 ); 4.42 @@ -69,16 +75,10 @@ 4.43 //noinspection unchecked 4.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 4.45 } catch (ClassNotFoundException e) { 4.46 - e.printStackTrace(); 4.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 4.48 } catch (InvocationTargetException e) { 4.49 - e.printStackTrace(); 4.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 4.51 - } catch (NoSuchMethodException e) { 4.52 - e.printStackTrace(); 4.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 4.54 } catch (IllegalAccessException e) { 4.55 - e.printStackTrace(); 4.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 4.57 } catch (SecurityException e) { 4.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
5.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Mon Oct 27 12:57:38 2014 -0700 5.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Fri Oct 24 15:02:28 2014 +0200 5.3 @@ -38,6 +38,9 @@ 5.4 5.5 /** 5.6 * Utils class. 5.7 + * 5.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 5.9 + * 5.10 * Has *package private* access to avoid inappropriate usage. 5.11 */ 5.12 final class Utils { 5.13 @@ -51,17 +54,20 @@ 5.14 5.15 static { // we statically initializing REFLECTION_NAVIGATOR property 5.16 try { 5.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 5.18 - //noinspection unchecked 5.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 5.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 5.21 5.22 // requires accessClassInPackage privilege 5.23 - AccessController.doPrivileged( 5.24 - new PrivilegedAction<Object>() { 5.25 + final Method getInstance = AccessController.doPrivileged( 5.26 + new PrivilegedAction<Method>() { 5.27 @Override 5.28 - public Object run() { 5.29 - getInstance.setAccessible(true); 5.30 - return null; 5.31 + public Method run() { 5.32 + try { 5.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 5.34 + getInstance.setAccessible(true); 5.35 + return getInstance; 5.36 + } catch (NoSuchMethodException e) { 5.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 5.38 + } 5.39 } 5.40 } 5.41 ); 5.42 @@ -69,16 +75,10 @@ 5.43 //noinspection unchecked 5.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 5.45 } catch (ClassNotFoundException e) { 5.46 - e.printStackTrace(); 5.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 5.48 } catch (InvocationTargetException e) { 5.49 - e.printStackTrace(); 5.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 5.51 - } catch (NoSuchMethodException e) { 5.52 - e.printStackTrace(); 5.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 5.54 } catch (IllegalAccessException e) { 5.55 - e.printStackTrace(); 5.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 5.57 } catch (SecurityException e) { 5.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
6.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Mon Oct 27 12:57:38 2014 -0700 6.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Fri Oct 24 15:02:28 2014 +0200 6.3 @@ -38,6 +38,9 @@ 6.4 6.5 /** 6.6 * Utils class. 6.7 + * 6.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 6.9 + * 6.10 * Has *package private* access to avoid inappropriate usage. 6.11 */ 6.12 final class Utils { 6.13 @@ -51,17 +54,20 @@ 6.14 6.15 static { // we statically initializing REFLECTION_NAVIGATOR property 6.16 try { 6.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 6.18 - //noinspection unchecked 6.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 6.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 6.21 6.22 // requires accessClassInPackage privilege 6.23 - AccessController.doPrivileged( 6.24 - new PrivilegedAction<Object>() { 6.25 + final Method getInstance = AccessController.doPrivileged( 6.26 + new PrivilegedAction<Method>() { 6.27 @Override 6.28 - public Object run() { 6.29 - getInstance.setAccessible(true); 6.30 - return null; 6.31 + public Method run() { 6.32 + try { 6.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 6.34 + getInstance.setAccessible(true); 6.35 + return getInstance; 6.36 + } catch (NoSuchMethodException e) { 6.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 6.38 + } 6.39 } 6.40 } 6.41 ); 6.42 @@ -69,16 +75,10 @@ 6.43 //noinspection unchecked 6.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 6.45 } catch (ClassNotFoundException e) { 6.46 - e.printStackTrace(); 6.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 6.48 } catch (InvocationTargetException e) { 6.49 - e.printStackTrace(); 6.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 6.51 - } catch (NoSuchMethodException e) { 6.52 - e.printStackTrace(); 6.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 6.54 } catch (IllegalAccessException e) { 6.55 - e.printStackTrace(); 6.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 6.57 } catch (SecurityException e) { 6.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
7.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Mon Oct 27 12:57:38 2014 -0700 7.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Fri Oct 24 15:02:28 2014 +0200 7.3 @@ -38,6 +38,9 @@ 7.4 7.5 /** 7.6 * Utils class. 7.7 + * 7.8 + * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. 7.9 + * 7.10 * Has *package private* access to avoid inappropriate usage. 7.11 */ 7.12 final class Utils { 7.13 @@ -51,17 +54,20 @@ 7.14 7.15 static { // we statically initializing REFLECTION_NAVIGATOR property 7.16 try { 7.17 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 7.18 - //noinspection unchecked 7.19 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 7.20 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 7.21 7.22 // requires accessClassInPackage privilege 7.23 - AccessController.doPrivileged( 7.24 - new PrivilegedAction<Object>() { 7.25 + final Method getInstance = AccessController.doPrivileged( 7.26 + new PrivilegedAction<Method>() { 7.27 @Override 7.28 - public Object run() { 7.29 - getInstance.setAccessible(true); 7.30 - return null; 7.31 + public Method run() { 7.32 + try { 7.33 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 7.34 + getInstance.setAccessible(true); 7.35 + return getInstance; 7.36 + } catch (NoSuchMethodException e) { 7.37 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 7.38 + } 7.39 } 7.40 } 7.41 ); 7.42 @@ -69,16 +75,10 @@ 7.43 //noinspection unchecked 7.44 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 7.45 } catch (ClassNotFoundException e) { 7.46 - e.printStackTrace(); 7.47 throw new IllegalStateException("Can't find ReflectionNavigator class"); 7.48 } catch (InvocationTargetException e) { 7.49 - e.printStackTrace(); 7.50 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 7.51 - } catch (NoSuchMethodException e) { 7.52 - e.printStackTrace(); 7.53 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 7.54 } catch (IllegalAccessException e) { 7.55 - e.printStackTrace(); 7.56 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 7.57 } catch (SecurityException e) { 7.58 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
8.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java Mon Oct 27 12:57:38 2014 -0700 8.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java Fri Oct 24 15:02:28 2014 +0200 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -25,8 +25,10 @@ 8.11 8.12 package com.sun.xml.internal.bind.v2.util; 8.13 8.14 -import com.sun.xml.internal.bind.Util; 8.15 import com.sun.xml.internal.bind.v2.Messages; 8.16 + 8.17 +import java.security.AccessController; 8.18 +import java.security.PrivilegedAction; 8.19 import java.util.logging.Level; 8.20 import java.util.logging.Logger; 8.21 import javax.xml.XMLConstants; 8.22 @@ -43,8 +45,6 @@ 8.23 import org.xml.sax.SAXNotRecognizedException; 8.24 import org.xml.sax.SAXNotSupportedException; 8.25 8.26 -import static com.sun.xml.internal.bind.Util.getSystemProperty; 8.27 - 8.28 /** 8.29 * Provides helper methods for creating properly configured XML parser 8.30 * factory instances with namespace support turned on and configured for 8.31 @@ -68,7 +68,14 @@ 8.32 */ 8.33 private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity"; 8.34 8.35 - public static final boolean XML_SECURITY_DISABLED = Boolean.parseBoolean(getSystemProperty(DISABLE_XML_SECURITY)); 8.36 + private static final boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( 8.37 + new PrivilegedAction<Boolean>() { 8.38 + @Override 8.39 + public Boolean run() { 8.40 + return Boolean.getBoolean(DISABLE_XML_SECURITY); 8.41 + } 8.42 + } 8.43 + ); 8.44 8.45 private static boolean isXMLSecurityDisabled(boolean runtimeSetting) { 8.46 return XML_SECURITY_DISABLED || runtimeSetting;
9.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Mon Oct 27 12:57:38 2014 -0700 9.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Fri Oct 24 15:02:28 2014 +0200 9.3 @@ -54,17 +54,20 @@ 9.4 9.5 static { // we statically initializing REFLECTION_NAVIGATOR property 9.6 try { 9.7 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 9.8 - //noinspection unchecked 9.9 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 9.10 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 9.11 9.12 // requires accessClassInPackage privilege 9.13 - AccessController.doPrivileged( 9.14 - new PrivilegedAction<Object>() { 9.15 + final Method getInstance = AccessController.doPrivileged( 9.16 + new PrivilegedAction<Method>() { 9.17 @Override 9.18 - public Object run() { 9.19 - getInstance.setAccessible(true); 9.20 - return null; 9.21 + public Method run() { 9.22 + try { 9.23 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 9.24 + getInstance.setAccessible(true); 9.25 + return getInstance; 9.26 + } catch (NoSuchMethodException e) { 9.27 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 9.28 + } 9.29 } 9.30 } 9.31 ); 9.32 @@ -72,16 +75,10 @@ 9.33 //noinspection unchecked 9.34 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 9.35 } catch (ClassNotFoundException e) { 9.36 - e.printStackTrace(); 9.37 throw new IllegalStateException("Can't find ReflectionNavigator class"); 9.38 } catch (InvocationTargetException e) { 9.39 - e.printStackTrace(); 9.40 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 9.41 - } catch (NoSuchMethodException e) { 9.42 - e.printStackTrace(); 9.43 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 9.44 } catch (IllegalAccessException e) { 9.45 - e.printStackTrace(); 9.46 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 9.47 } catch (SecurityException e) { 9.48 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
10.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Mon Oct 27 12:57:38 2014 -0700 10.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java Fri Oct 24 15:02:28 2014 +0200 10.3 @@ -147,19 +147,12 @@ 10.4 } 10.5 10.6 public EndpointReference readEndpointReference(final Source eprInfoset) { 10.7 - // EPR constructors are private, so we need privilege escalation. 10.8 - // this unmarshalling can only access instances of a fixed, known set of classes, 10.9 - // so doing that shouldn't introduce security vulnerability. 10.10 - return AccessController.doPrivileged(new PrivilegedAction<EndpointReference>() { 10.11 - public EndpointReference run() { 10.12 - try { 10.13 - Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); 10.14 - return (EndpointReference) unmarshaller.unmarshal(eprInfoset); 10.15 - } catch (JAXBException e) { 10.16 - throw new WebServiceException("Error creating Marshaller or marshalling.", e); 10.17 - } 10.18 - } 10.19 - }); 10.20 + try { 10.21 + Unmarshaller unmarshaller = eprjc.get().createUnmarshaller(); 10.22 + return (EndpointReference) unmarshaller.unmarshal(eprInfoset); 10.23 + } catch (JAXBException e) { 10.24 + throw new WebServiceException("Error creating Marshaller or marshalling.", e); 10.25 + } 10.26 } 10.27 10.28 public <T> T getPort(EndpointReference endpointReference, Class<T> clazz, WebServiceFeature... webServiceFeatures) {
11.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Mon Oct 27 12:57:38 2014 -0700 11.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/db/Utils.java Fri Oct 24 15:02:28 2014 +0200 11.3 @@ -54,17 +54,20 @@ 11.4 11.5 static { // we statically initializing REFLECTION_NAVIGATOR property 11.6 try { 11.7 - Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 11.8 - //noinspection unchecked 11.9 - final Method getInstance = refNav.getDeclaredMethod("getInstance"); 11.10 + final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); 11.11 11.12 // requires accessClassInPackage privilege 11.13 - AccessController.doPrivileged( 11.14 - new PrivilegedAction<Object>() { 11.15 + final Method getInstance = AccessController.doPrivileged( 11.16 + new PrivilegedAction<Method>() { 11.17 @Override 11.18 - public Object run() { 11.19 - getInstance.setAccessible(true); 11.20 - return null; 11.21 + public Method run() { 11.22 + try { 11.23 + Method getInstance = refNav.getDeclaredMethod("getInstance"); 11.24 + getInstance.setAccessible(true); 11.25 + return getInstance; 11.26 + } catch (NoSuchMethodException e) { 11.27 + throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 11.28 + } 11.29 } 11.30 } 11.31 ); 11.32 @@ -72,16 +75,10 @@ 11.33 //noinspection unchecked 11.34 REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null); 11.35 } catch (ClassNotFoundException e) { 11.36 - e.printStackTrace(); 11.37 throw new IllegalStateException("Can't find ReflectionNavigator class"); 11.38 } catch (InvocationTargetException e) { 11.39 - e.printStackTrace(); 11.40 throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); 11.41 - } catch (NoSuchMethodException e) { 11.42 - e.printStackTrace(); 11.43 - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); 11.44 } catch (IllegalAccessException e) { 11.45 - e.printStackTrace(); 11.46 throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); 11.47 } catch (SecurityException e) { 11.48 LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e);
12.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Mon Oct 27 12:57:38 2014 -0700 12.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Fri Oct 24 15:02:28 2014 +0200 12.3 @@ -63,6 +63,8 @@ 12.4 import java.io.OutputStreamWriter; 12.5 import java.io.Writer; 12.6 import java.net.URL; 12.7 +import java.security.AccessController; 12.8 +import java.security.PrivilegedAction; 12.9 import java.util.ArrayList; 12.10 import java.util.Enumeration; 12.11 import java.util.Iterator; 12.12 @@ -84,12 +86,16 @@ 12.13 12.14 private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName()); 12.15 12.16 - private static boolean XML_SECURITY_DISABLED; 12.17 + private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.ws.disableXmlSecurity"; 12.18 12.19 - static { 12.20 - String disableXmlSecurity = System.getProperty("com.sun.xml.internal.ws.disableXmlSecurity"); 12.21 - XML_SECURITY_DISABLED = disableXmlSecurity == null || !Boolean.valueOf(disableXmlSecurity); 12.22 - } 12.23 + private static boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( 12.24 + new PrivilegedAction<Boolean>() { 12.25 + @Override 12.26 + public Boolean run() { 12.27 + return Boolean.getBoolean(DISABLE_XML_SECURITY); 12.28 + } 12.29 + } 12.30 + ); 12.31 12.32 public static String getPrefix(String s) { 12.33 int i = s.indexOf(':');