Merge
authorlana
Fri, 17 Apr 2015 10:23:30 -0700
changeset 29954 2146836f6f52
parent 29951 43bfb9d9010d (current diff)
parent 29953 d5894097fe65 (diff)
child 29955 bb01b6577ee9
Merge
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java	Fri Apr 17 09:59:45 2015 -0700
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java	Fri Apr 17 10:23:30 2015 -0700
@@ -30,6 +30,8 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.ref.WeakReference;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.logging.Level;
@@ -85,19 +87,25 @@
         if(consRef!=null)
             cons = consRef.get();
         if(cons==null) {
-            try {
-                cons = clazz.getDeclaredConstructor(emptyClass);
-            } catch (NoSuchMethodException e) {
-                logger.log(Level.INFO,"No default constructor found on "+clazz,e);
-                NoSuchMethodError exp;
-                if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
-                    exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName()));
-                } else {
-                    exp = new NoSuchMethodError(e.getMessage());
+            cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() {
+                @Override
+                public Constructor<T> run() {
+                    try {
+                        return clazz.getDeclaredConstructor(emptyClass);
+                    } catch (NoSuchMethodException e) {
+                        logger.log(Level.INFO,"No default constructor found on "+clazz,e);
+                        NoSuchMethodError exp;
+                        if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
+                            exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS
+                                                                .format(clazz.getName()));
+                        } else {
+                            exp = new NoSuchMethodError(e.getMessage());
+                        }
+                        exp.initCause(e);
+                        throw exp;
+                    }
                 }
-                exp.initCause(e);
-                throw exp;
-            }
+            });
 
             int classMod = clazz.getModifiers();
 
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java	Fri Apr 17 09:59:45 2015 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java	Fri Apr 17 10:23:30 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -108,7 +108,8 @@
         }
 
         public Thread newThread(Runnable r) {
-            Thread t = new Thread(null, r, namePrefix + threadNumber.getAndIncrement(), 0);
+            Thread t = ThreadHelper.createNewThread(r);
+            t.setName(namePrefix + threadNumber.getAndIncrement());
             if (!t.isDaemon()) {
                 t.setDaemon(true);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java	Fri Apr 17 10:23:30 2015 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.pipe;
+
+import java.lang.reflect.Constructor;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * Simple utility class to instantiate correct Thread instance
+ * depending on runtime context (jdk/non-jdk usage)
+ *
+ * @author miroslav.kos@oracle.com
+ */
+final class ThreadHelper {
+
+    private static final String SAFE_THREAD_NAME = "sun.misc.ManagedLocalsThread";
+    private static final Constructor THREAD_CONSTRUCTOR;
+
+    // no instantiating wanted
+    private ThreadHelper() {
+    }
+
+    static {
+        THREAD_CONSTRUCTOR = AccessController.doPrivileged(
+                new PrivilegedAction<Constructor> () {
+                    @Override
+                    public Constructor run() {
+                        try {
+                            Class cls = Class.forName(SAFE_THREAD_NAME);
+                            if (cls != null) {
+                                return cls.getConstructor(Runnable.class);
+                            }
+                        } catch (ClassNotFoundException ignored) {
+                        } catch (NoSuchMethodException ignored) {
+                        }
+                        return null;
+                    }
+                }
+        );
+    }
+
+    static Thread createNewThread(final Runnable r) {
+        if (isJDKInternal()) {
+            return AccessController.doPrivileged(
+                    new PrivilegedAction<Thread>() {
+                        @Override
+                        public Thread run() {
+                            try {
+                                return (Thread) THREAD_CONSTRUCTOR.newInstance(r);
+                            } catch (Exception e) {
+                                return new Thread(r);
+                            }
+                        }
+                    }
+            );
+        } else {
+            return new Thread(r);
+        }
+    }
+
+    private static boolean isJDKInternal() {
+        String className = ThreadHelper.class.getName();
+        return className.contains(".internal.");
+    }
+}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Fri Apr 17 09:59:45 2015 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Fri Apr 17 10:23:30 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, 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
@@ -894,15 +894,6 @@
         return wsdlService;
     }
 
-    static class DaemonThreadFactory implements ThreadFactory {
-        @Override
-        public Thread newThread(Runnable r) {
-            Thread daemonThread = new Thread(r);
-            daemonThread.setDaemon(Boolean.TRUE);
-            return daemonThread;
-        }
-    }
-
     protected static final WebServiceFeature[] EMPTY_FEATURES = new WebServiceFeature[0];
 
     private static ClassLoader getDelegatingLoader(ClassLoader loader1, ClassLoader loader2) {
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java	Fri Apr 17 09:59:45 2015 -0700
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/BindingHelper.java	Fri Apr 17 10:23:30 2015 -0700
@@ -36,9 +36,6 @@
 //TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver
 import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
 
-//TODO MtomCodec
-import com.sun.xml.internal.bind.v2.runtime.output.Encoded;
-
 //TODO ExceptionBean
 import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;
 
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java	Fri Apr 17 09:59:45 2015 -0700
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wsdl/document/soap/SOAPConstants.java	Fri Apr 17 10:23:30 2015 -0700
@@ -25,8 +25,6 @@
 
 package com.sun.tools.internal.ws.wsdl.document.soap;
 
-import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
-
 import javax.xml.namespace.QName;
 
 /**
@@ -37,7 +35,9 @@
 public interface SOAPConstants {
 
     // namespace URIs
-    public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
+    public static final String URI_ENVELOPE =
+        "http://schemas.xmlsoap.org/soap/envelope/";
+
     public static final String NS_WSDL_SOAP =
         "http://schemas.xmlsoap.org/wsdl/soap/";
     public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";