/hg/release/icedtea7-forest-2.3/jaxws: 3 new changesets
andrew at icedtea.classpath.org
andrew at icedtea.classpath.org
Fri Mar 21 19:39:16 UTC 2014
changeset cd3d3cf45c6e in /hg/release/icedtea7-forest-2.3/jaxws
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jaxws?cmd=changeset;node=cd3d3cf45c6e
author: mkos
date: Fri Nov 08 20:15:52 2013 +0100
8027224: test regression - ClassNotFoundException
Summary: test regression; fix also reviewed by Filipp Zkinkin, Iaroslav Savytskyi, Alexander Fomin
Reviewed-by: mgrebac
changeset 7d297f4939bf in /hg/release/icedtea7-forest-2.3/jaxws
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jaxws?cmd=changeset;node=7d297f4939bf
author: mkos
date: Thu Mar 20 16:23:27 2014 +0000
8027378: Two closed/javax/xml/8005432 fails with jdk7u51b04
Summary: test regression; fix also reviewed by Maxim Soloviev, Alexander Fomin
Reviewed-by: mgrebac
changeset 482a3f64a8ea in /hg/release/icedtea7-forest-2.3/jaxws
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jaxws?cmd=changeset;node=482a3f64a8ea
author: mkos
date: Thu Nov 21 11:15:32 2013 +0100
8028382: Two javax/xml/8005433 tests still fail after the fix JDK-8028147
Summary: test regression; fix also reviewed by Iaroslav Savytskyi, Alexander Fomin
Reviewed-by: mchung
diffstat:
src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java | 28 +-----
src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java | 46 ++++++++-
2 files changed, 42 insertions(+), 32 deletions(-)
diffs (150 lines):
diff -r 1067e01a4e0e -r 482a3f64a8ea src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java
--- a/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java Tue Jan 14 20:24:45 2014 -0500
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java Thu Nov 21 11:15:32 2013 +0100
@@ -58,7 +58,6 @@
// ---------------------------------------
public Class getSuperClass(Class clazz) {
- checkPackageAccess(clazz.getName());
if (clazz == Object.class) {
return null;
}
@@ -266,12 +265,10 @@
}
public Collection<? extends Field> getDeclaredFields(Class clazz) {
- checkPackageAccess(clazz.getName());
return Arrays.asList(clazz.getDeclaredFields());
}
public Field getDeclaredField(Class clazz, String fieldName) {
- checkPackageAccess(clazz.getName());
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
@@ -280,7 +277,6 @@
}
public Collection<? extends Method> getDeclaredMethods(Class clazz) {
- checkPackageAccess(clazz.getName());
return Arrays.asList(clazz.getDeclaredMethods());
}
@@ -525,7 +521,6 @@
}
public Field[] getEnumConstants(Class clazz) {
- checkPackageAccess(clazz.getName());
try {
Object[] values = clazz.getEnumConstants();
Field[] fields = new Field[values.length];
@@ -556,7 +551,6 @@
@Override
public Class loadObjectFactory(Class referencePoint, String pkg) {
String clName = pkg + ".ObjectFactory";
- checkPackageAccess(clName);
ClassLoader cl = referencePoint.getClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
@@ -581,7 +575,7 @@
// class Base<T> {
// T getX() { ... }
// }
- // to be overrided. Handling this correctly needs a careful implementation
+ // to be overriden. Handling this correctly needs a careful implementation
String name = method.getName();
Class[] params = method.getParameterTypes();
@@ -632,24 +626,4 @@
return t;
}
-
- /**
- * Checking if current thread can access class.
- *
- * @param clName name of the class to be checked
- * @throws SecurityException is thrown if thread doesn't have privileges
- */
- static void checkPackageAccess(String clName) {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- return;
- if (clName.startsWith("[")) { // array
- int nameStart = clName.lastIndexOf('[') + 2;
- if (nameStart > 1 && nameStart < clName.length())
- clName = clName.substring(nameStart);
- }
- int packageEnd = clName.lastIndexOf('.');
- if (packageEnd != -1)
- sm.checkPackageAccess(clName.substring(0, packageEnd));
- }
}
diff -r 1067e01a4e0e -r 482a3f64a8ea src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java Tue Jan 14 20:24:45 2014 -0500
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java Thu Nov 21 11:15:32 2013 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -59,6 +59,12 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.ReflectPermission;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
@@ -546,10 +552,40 @@
// ignore
}
- try {
- JAXB_CONTEXT = (JAXBRIContext)JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
- } catch (JAXBException e) {
- throw new Error(e); // this must be a bug in our code
+ JAXB_CONTEXT = createJAXBContext();
+ }
+
+ private static JAXBRIContext createJAXBContext() {
+
+ // in jdk runtime doPrivileged is necessary since JAX-WS internal classes are in restricted packages
+ if (isJDKRuntime()) {
+ Permissions permissions = new Permissions();
+ permissions.add(new RuntimePermission("accessClassInPackage.com.sun." + "xml.internal.ws.fault"));
+ permissions.add(new ReflectPermission("suppressAccessChecks"));
+ return AccessController.doPrivileged(
+ new PrivilegedAction<JAXBRIContext>() {
+ @Override
+ public JAXBRIContext run() {
+ try {
+ return (JAXBRIContext) JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
+ } catch (JAXBException e) {
+ throw new Error(e);
+ }
+ }
+ },
+ new AccessControlContext(new ProtectionDomain[]{new ProtectionDomain(null, permissions)})
+ );
+
+ } else {
+ try {
+ return (JAXBRIContext) JAXBContext.newInstance(SOAP11Fault.class, SOAP12Fault.class);
+ } catch (JAXBException e) {
+ throw new Error(e);
+ }
}
}
+
+ private static boolean isJDKRuntime() {
+ return SOAPFaultBuilder.class.getName().contains("internal");
+ }
}
More information about the distro-pkg-dev
mailing list