< prev index next >
jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/ThreadHelper.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -66,13 +66,11 @@
// constructor newly added in Java SE 9
}
Class<?> cls = Class.forName(SAFE_THREAD_NAME);
Constructor<?> ctr = cls.getConstructor(Runnable.class);
return new SunMiscThreadFactory(ctr);
- } catch (ClassNotFoundException ignored) {
- } catch (NoSuchMethodException ignored) {
- }
+ } catch (ClassNotFoundException | NoSuchMethodException ignored) {}
return new LegacyThreadFactory();
}
}
);
}
@@ -88,20 +86,22 @@
JDK9ThreadFactory(Constructor<Thread> ctr) { this.ctr = ctr; }
@Override public Thread newThread(Runnable r) {
try {
return ctr.newInstance(null, r, "toBeReplaced", 0, false);
} catch (ReflectiveOperationException x) {
- throw new InternalError(x);
+ InternalError ie = new InternalError(x.getMessage());
+ ie.initCause(ie);
+ throw ie;
}
}
}
// A Thread factory backed by sun.misc.ManagedLocalsThread
private static class SunMiscThreadFactory implements ThreadFactory {
final Constructor<?> ctr;
SunMiscThreadFactory(Constructor<?> ctr) { this.ctr = ctr; }
- @Override public Thread newThread(Runnable r) {
+ @Override public Thread newThread(final Runnable r) {
return AccessController.doPrivileged(
new PrivilegedAction<Thread>() {
@Override
public Thread run() {
try {
< prev index next >