/hg/release/icedtea7-forest-2.5/jaxws: 8035613: With active Secu...
andrew at icedtea.classpath.org
andrew at icedtea.classpath.org
Tue Jul 15 21:11:49 UTC 2014
changeset 19e5d8e33c52 in /hg/release/icedtea7-forest-2.5/jaxws
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.5/jaxws?cmd=changeset;node=19e5d8e33c52
author: mkos
date: Wed Apr 09 10:15:04 2014 -0400
8035613: With active Securitymanager JAXBContext.newInstance fails
Reviewed-by: mullan, mgrebac
diffstat:
src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java | 26 +++++++--
src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java | 26 +++++++--
7 files changed, 133 insertions(+), 49 deletions(-)
diffs (406 lines):
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/model/nav/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/api/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
diff -r 73f3c7ca3b99 -r 19e5d8e33c52 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 Sat Jun 14 08:08:00 2014 +0100
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/Utils.java Wed Apr 09 10:15:04 2014 -0400
@@ -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
@@ -31,6 +31,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,22 +43,32 @@
*
* Has *package private* access to avoid inappropriate usage.
*/
-/* package */ final class Utils {
+final class Utils {
private static final Logger LOGGER = Logger.getLogger(Utils.class.getName());
/**
* static ReflectionNavigator field to avoid usage of reflection every time we use it.
*/
- /* package */ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
+ static final Navigator<Type, Class, Field, Method> REFLECTION_NAVIGATOR;
static { // we statically initializing REFLECTION_NAVIGATOR property
- Class refNav = null;
try {
- refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
+ Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator");
//noinspection unchecked
- Method getInstance = refNav.getDeclaredMethod("getInstance");
- getInstance.setAccessible(true);
+ final Method getInstance = refNav.getDeclaredMethod("getInstance");
+
+ // requires accessClassInPackage privilege
+ AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ getInstance.setAccessible(true);
+ return null;
+ }
+ }
+ );
+
//noinspection unchecked
REFLECTION_NAVIGATOR = (Navigator<Type, Class, Field, Method>) getInstance.invoke(null);
} catch (ClassNotFoundException e) {
More information about the distro-pkg-dev
mailing list