Merge
This commit is contained in:
commit
455272b6b7
@ -303,3 +303,4 @@ f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57
|
|||||||
6e78dd9b121037719a065fe8fb25b936babdfecb jdk9-b58
|
6e78dd9b121037719a065fe8fb25b936babdfecb jdk9-b58
|
||||||
39e8a131289e8386aa4c3e4b184faa812a7c0421 jdk9-b59
|
39e8a131289e8386aa4c3e4b184faa812a7c0421 jdk9-b59
|
||||||
9fa2185bee17462d1014538bff60af6e6f0b01e7 jdk9-b60
|
9fa2185bee17462d1014538bff60af6e6f0b01e7 jdk9-b60
|
||||||
|
ea38728b4f4bdd8fd0d7a89b18069f521cf05013 jdk9-b61
|
||||||
|
@ -463,3 +463,4 @@ fd2d5ec7e7b16c7bf4043a7fe7cfd8af96b819e2 jdk9-b56
|
|||||||
ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
|
ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
|
||||||
96bcaec07cb165782bae1b9a1f28450b37a10e3a jdk9-b59
|
96bcaec07cb165782bae1b9a1f28450b37a10e3a jdk9-b59
|
||||||
9c916db4bf3bc164a47b5a9cefe5ffd71e111f6a jdk9-b60
|
9c916db4bf3bc164a47b5a9cefe5ffd71e111f6a jdk9-b60
|
||||||
|
715d2da5801c410746e92f08066d53bde1496286 jdk9-b61
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -303,3 +303,4 @@ c76339e86ea7da5d9ac7856f3fae9ef73eef04a2 jdk9-b57
|
|||||||
36fc65e80d811ee43aedfc69284224b86a403662 jdk9-b58
|
36fc65e80d811ee43aedfc69284224b86a403662 jdk9-b58
|
||||||
48ee960f29df93a9b2a895621321358a86909086 jdk9-b59
|
48ee960f29df93a9b2a895621321358a86909086 jdk9-b59
|
||||||
84c5527f742bc64562e47d3149c16197fe1c4c1a jdk9-b60
|
84c5527f742bc64562e47d3149c16197fe1c4c1a jdk9-b60
|
||||||
|
da84dcac1b0b12c5b836b05ac75ecbfadee0cd32 jdk9-b61
|
||||||
|
@ -12,4 +12,5 @@ jdk.crypto.ucrypto
|
|||||||
jdk.localedata
|
jdk.localedata
|
||||||
jdk.naming.dns
|
jdk.naming.dns
|
||||||
jdk.scripting.nashorn
|
jdk.scripting.nashorn
|
||||||
|
jdk.xml.dom
|
||||||
jdk.zipfs
|
jdk.zipfs
|
||||||
|
@ -105,7 +105,7 @@ final class EPollPort
|
|||||||
|
|
||||||
// create the queue and offer the special event to ensure that the first
|
// create the queue and offer the special event to ensure that the first
|
||||||
// threads polls
|
// threads polls
|
||||||
this.queue = new ArrayBlockingQueue<Event>(MAX_EPOLL_EVENTS);
|
this.queue = new ArrayBlockingQueue<>(MAX_EPOLL_EVENTS);
|
||||||
this.queue.offer(NEED_TO_POLL);
|
this.queue.offer(NEED_TO_POLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ class LinuxNativeDispatcher extends UnixNativeDispatcher {
|
|||||||
private static native void init();
|
private static native void init();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("nio");
|
System.loadLibrary("nio");
|
||||||
return null;
|
return null;
|
||||||
|
@ -190,7 +190,7 @@ class LinuxWatchService
|
|||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
this.ifd = ifd;
|
this.ifd = ifd;
|
||||||
this.socketpair = sp;
|
this.socketpair = sp;
|
||||||
this.wdToKey = new HashMap<Integer,LinuxWatchKey>();
|
this.wdToKey = new HashMap<>();
|
||||||
this.address = unsafe.allocateMemory(BUFFER_SIZE);
|
this.address = unsafe.allocateMemory(BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ class LinuxWatchService
|
|||||||
private static native int poll(int fd1, int fd2) throws UnixException;
|
private static native int poll(int fd1, int fd2) throws UnixException;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("nio");
|
System.loadLibrary("nio");
|
||||||
return null;
|
return null;
|
||||||
|
@ -68,7 +68,7 @@ class MagicFileTypeDetector extends AbstractFileTypeDetector {
|
|||||||
private static native byte[] probe0(long pathAddress);
|
private static native byte[] probe0(long pathAddress);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("nio");
|
System.loadLibrary("nio");
|
||||||
|
@ -87,7 +87,7 @@ class NativeUnpack {
|
|||||||
// If loading from stand alone build uncomment this.
|
// If loading from stand alone build uncomment this.
|
||||||
// System.loadLibrary("unpack");
|
// System.loadLibrary("unpack");
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("unpack");
|
System.loadLibrary("unpack");
|
||||||
return null;
|
return null;
|
||||||
|
@ -1210,7 +1210,7 @@ class Package {
|
|||||||
// This keeps files of similar format near each other.
|
// This keeps files of similar format near each other.
|
||||||
// Put class files at the end, keeping their fixed order.
|
// Put class files at the end, keeping their fixed order.
|
||||||
// Be sure the JAR file's required manifest stays at the front. (4893051)
|
// Be sure the JAR file's required manifest stays at the front. (4893051)
|
||||||
Collections.sort(files, new Comparator<File>() {
|
Collections.sort(files, new Comparator<>() {
|
||||||
public int compare(File r0, File r1) {
|
public int compare(File r0, File r1) {
|
||||||
// Get the file name.
|
// Get the file name.
|
||||||
String f0 = r0.nameString;
|
String f0 = r0.nameString;
|
||||||
|
@ -1151,7 +1151,7 @@ class PackageReader extends BandStructure {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Comparator<Entry> entryOutputOrder = new Comparator<Entry>() {
|
Comparator<Entry> entryOutputOrder = new Comparator<>() {
|
||||||
public int compare(Entry e0, Entry e1) {
|
public int compare(Entry e0, Entry e1) {
|
||||||
int k0 = getOutputIndex(e0);
|
int k0 = getOutputIndex(e0);
|
||||||
int k1 = getOutputIndex(e1);
|
int k1 = getOutputIndex(e1);
|
||||||
|
@ -829,7 +829,7 @@ class PackageWriter extends BandStructure {
|
|||||||
maxFlags = new int[ATTR_CONTEXT_LIMIT];
|
maxFlags = new int[ATTR_CONTEXT_LIMIT];
|
||||||
allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
|
allLayouts = new FixedList<>(ATTR_CONTEXT_LIMIT);
|
||||||
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
|
for (int i = 0; i < ATTR_CONTEXT_LIMIT; i++) {
|
||||||
allLayouts.set(i, new HashMap<Attribute.Layout, int[]>());
|
allLayouts.set(i, new HashMap<>());
|
||||||
}
|
}
|
||||||
// Collect maxFlags and allLayouts.
|
// Collect maxFlags and allLayouts.
|
||||||
for (Class cls : pkg.classes) {
|
for (Class cls : pkg.classes) {
|
||||||
@ -892,7 +892,7 @@ class PackageWriter extends BandStructure {
|
|||||||
// Sort by count, most frequent first.
|
// Sort by count, most frequent first.
|
||||||
// Predefs. participate in this sort, though it does not matter.
|
// Predefs. participate in this sort, though it does not matter.
|
||||||
Arrays.sort(layoutsAndCounts,
|
Arrays.sort(layoutsAndCounts,
|
||||||
new Comparator<Map.Entry<Attribute.Layout, int[]>>() {
|
new Comparator<>() {
|
||||||
public int compare(Map.Entry<Attribute.Layout, int[]> e0,
|
public int compare(Map.Entry<Attribute.Layout, int[]> e0,
|
||||||
Map.Entry<Attribute.Layout, int[]> e1) {
|
Map.Entry<Attribute.Layout, int[]> e1) {
|
||||||
// Primary sort key is count, reversed.
|
// Primary sort key is count, reversed.
|
||||||
@ -1010,7 +1010,7 @@ class PackageWriter extends BandStructure {
|
|||||||
int numAttrDefs = defList.size();
|
int numAttrDefs = defList.size();
|
||||||
Object[][] defs = new Object[numAttrDefs][];
|
Object[][] defs = new Object[numAttrDefs][];
|
||||||
defList.toArray(defs);
|
defList.toArray(defs);
|
||||||
Arrays.sort(defs, new Comparator<Object[]>() {
|
Arrays.sort(defs, new Comparator<>() {
|
||||||
public int compare(Object[] a0, Object[] a1) {
|
public int compare(Object[] a0, Object[] a1) {
|
||||||
// Primary sort key is attr def header.
|
// Primary sort key is attr def header.
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -64,7 +64,7 @@ class ExpiringCache {
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
ExpiringCache(long millisUntilExpiration) {
|
ExpiringCache(long millisUntilExpiration) {
|
||||||
this.millisUntilExpiration = millisUntilExpiration;
|
this.millisUntilExpiration = millisUntilExpiration;
|
||||||
map = new LinkedHashMap<String,Entry>() {
|
map = new LinkedHashMap<>() {
|
||||||
protected boolean removeEldestEntry(Map.Entry<String,Entry> eldest) {
|
protected boolean removeEldestEntry(Map.Entry<String,Entry> eldest) {
|
||||||
return size() > MAX_ENTRIES;
|
return size() > MAX_ENTRIES;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// store only the canonical cpath if possible
|
// store only the canonical cpath if possible
|
||||||
cpath = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
cpath = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public String run() {
|
public String run() {
|
||||||
try {
|
try {
|
||||||
String path = cpath;
|
String path = cpath;
|
||||||
|
@ -1263,7 +1263,7 @@ public class ObjectInputStream
|
|||||||
*/
|
*/
|
||||||
private static boolean auditSubclass(final Class<?> subcl) {
|
private static boolean auditSubclass(final Class<?> subcl) {
|
||||||
Boolean result = AccessController.doPrivileged(
|
Boolean result = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Boolean>() {
|
new PrivilegedAction<>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
for (Class<?> cl = subcl;
|
for (Class<?> cl = subcl;
|
||||||
cl != ObjectInputStream.class;
|
cl != ObjectInputStream.class;
|
||||||
@ -2255,7 +2255,7 @@ public class ObjectInputStream
|
|||||||
try {
|
try {
|
||||||
while (list != null) {
|
while (list != null) {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Void>()
|
new PrivilegedExceptionAction<>()
|
||||||
{
|
{
|
||||||
public Void run() throws InvalidObjectException {
|
public Void run() throws InvalidObjectException {
|
||||||
list.obj.validateObject();
|
list.obj.validateObject();
|
||||||
|
@ -1066,7 +1066,7 @@ public class ObjectOutputStream
|
|||||||
*/
|
*/
|
||||||
private static boolean auditSubclass(final Class<?> subcl) {
|
private static boolean auditSubclass(final Class<?> subcl) {
|
||||||
Boolean result = AccessController.doPrivileged(
|
Boolean result = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Boolean>() {
|
new PrivilegedAction<>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
for (Class<?> cl = subcl;
|
for (Class<?> cl = subcl;
|
||||||
cl != ObjectOutputStream.class;
|
cl != ObjectOutputStream.class;
|
||||||
|
@ -367,7 +367,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
entry = th;
|
entry = th;
|
||||||
}
|
}
|
||||||
if (future.set(entry)) {
|
if (future.set(entry)) {
|
||||||
Caches.localDescs.put(key, new SoftReference<Object>(entry));
|
Caches.localDescs.put(key, new SoftReference<>(entry));
|
||||||
} else {
|
} else {
|
||||||
// nested lookup call already set future
|
// nested lookup call already set future
|
||||||
entry = future.get();
|
entry = future.get();
|
||||||
@ -430,7 +430,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
}
|
}
|
||||||
if (interrupted) {
|
if (interrupted) {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Void>() {
|
new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
return null;
|
return null;
|
||||||
@ -465,7 +465,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
localDesc = this;
|
localDesc = this;
|
||||||
|
|
||||||
if (serializable) {
|
if (serializable) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
if (isEnum) {
|
if (isEnum) {
|
||||||
suid = Long.valueOf(0);
|
suid = Long.valueOf(0);
|
||||||
@ -1733,7 +1733,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
fieldSigs[i] = new MemberSignature(fields[i]);
|
fieldSigs[i] = new MemberSignature(fields[i]);
|
||||||
}
|
}
|
||||||
Arrays.sort(fieldSigs, new Comparator<MemberSignature>() {
|
Arrays.sort(fieldSigs, new Comparator<>() {
|
||||||
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
||||||
return ms1.name.compareTo(ms2.name);
|
return ms1.name.compareTo(ms2.name);
|
||||||
}
|
}
|
||||||
@ -1764,7 +1764,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
for (int i = 0; i < cons.length; i++) {
|
for (int i = 0; i < cons.length; i++) {
|
||||||
consSigs[i] = new MemberSignature(cons[i]);
|
consSigs[i] = new MemberSignature(cons[i]);
|
||||||
}
|
}
|
||||||
Arrays.sort(consSigs, new Comparator<MemberSignature>() {
|
Arrays.sort(consSigs, new Comparator<>() {
|
||||||
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
||||||
return ms1.signature.compareTo(ms2.signature);
|
return ms1.signature.compareTo(ms2.signature);
|
||||||
}
|
}
|
||||||
@ -1787,7 +1787,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
for (int i = 0; i < methods.length; i++) {
|
for (int i = 0; i < methods.length; i++) {
|
||||||
methSigs[i] = new MemberSignature(methods[i]);
|
methSigs[i] = new MemberSignature(methods[i]);
|
||||||
}
|
}
|
||||||
Arrays.sort(methSigs, new Comparator<MemberSignature>() {
|
Arrays.sort(methSigs, new Comparator<>() {
|
||||||
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
public int compare(MemberSignature ms1, MemberSignature ms2) {
|
||||||
int comp = ms1.name.compareTo(ms2.name);
|
int comp = ms1.name.compareTo(ms2.name);
|
||||||
if (comp == 0) {
|
if (comp == 0) {
|
||||||
@ -2164,7 +2164,7 @@ public class ObjectStreamClass implements Serializable {
|
|||||||
entry = th;
|
entry = th;
|
||||||
}
|
}
|
||||||
future.set(entry);
|
future.set(entry);
|
||||||
Caches.reflectors.put(key, new SoftReference<Object>(entry));
|
Caches.reflectors.put(key, new SoftReference<>(entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry instanceof FieldReflector) {
|
if (entry instanceof FieldReflector) {
|
||||||
|
@ -45,7 +45,7 @@ class CharacterName {
|
|||||||
DataInputStream dis = null;
|
DataInputStream dis = null;
|
||||||
try {
|
try {
|
||||||
dis = new DataInputStream(new InflaterInputStream(
|
dis = new DataInputStream(new InflaterInputStream(
|
||||||
AccessController.doPrivileged(new PrivilegedAction<InputStream>()
|
AccessController.doPrivileged(new PrivilegedAction<>()
|
||||||
{
|
{
|
||||||
public InputStream run() {
|
public InputStream run() {
|
||||||
return getClass().getResourceAsStream("uniName.dat");
|
return getClass().getResourceAsStream("uniName.dat");
|
||||||
|
@ -437,7 +437,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
// (the stack depth is wrong for the Constructor's
|
// (the stack depth is wrong for the Constructor's
|
||||||
// security check to work)
|
// security check to work)
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
c.setAccessible(true);
|
c.setAccessible(true);
|
||||||
return null;
|
return null;
|
||||||
@ -1068,7 +1068,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
Reflection.getCallerClass(), true);
|
Reflection.getCallerClass(), true);
|
||||||
// Client is ok to access declared methods but j.l.Class might not be.
|
// Client is ok to access declared methods but j.l.Class might not be.
|
||||||
Method[] candidates = AccessController.doPrivileged(
|
Method[] candidates = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Method[]>() {
|
new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Method[] run() {
|
public Method[] run() {
|
||||||
return enclosingCandidate.getDeclaredMethods();
|
return enclosingCandidate.getDeclaredMethods();
|
||||||
@ -1228,7 +1228,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
Reflection.getCallerClass(), true);
|
Reflection.getCallerClass(), true);
|
||||||
// Client is ok to access declared methods but j.l.Class might not be.
|
// Client is ok to access declared methods but j.l.Class might not be.
|
||||||
Constructor<?>[] candidates = AccessController.doPrivileged(
|
Constructor<?>[] candidates = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Constructor<?>[]>() {
|
new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Constructor<?>[] run() {
|
public Constructor<?>[] run() {
|
||||||
return enclosingCandidate.getDeclaredConstructors();
|
return enclosingCandidate.getDeclaredConstructors();
|
||||||
@ -1542,7 +1542,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
// has already been ok'd by the SecurityManager.
|
// has already been ok'd by the SecurityManager.
|
||||||
|
|
||||||
return java.security.AccessController.doPrivileged(
|
return java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Class<?>[]>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Class<?>[] run() {
|
public Class<?>[] run() {
|
||||||
List<Class<?>> list = new ArrayList<>();
|
List<Class<?>> list = new ArrayList<>();
|
||||||
Class<?> currentClass = Class.this;
|
Class<?> currentClass = Class.this;
|
||||||
@ -3293,7 +3293,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
private static boolean initted = false;
|
private static boolean initted = false;
|
||||||
private static void checkInitted() {
|
private static void checkInitted() {
|
||||||
if (initted) return;
|
if (initted) return;
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
// Tests to ensure the system properties table is fully
|
// Tests to ensure the system properties table is fully
|
||||||
// initialized. This is needed because reflection code is
|
// initialized. This is needed because reflection code is
|
||||||
@ -3349,7 +3349,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||||||
try {
|
try {
|
||||||
final Method values = getMethod("values");
|
final Method values = getMethod("values");
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
values.setAccessible(true);
|
values.setAccessible(true);
|
||||||
return null;
|
return null;
|
||||||
|
@ -496,7 +496,7 @@ public abstract class ClassLoader {
|
|||||||
final String name = cls.getName();
|
final String name = cls.getName();
|
||||||
final int i = name.lastIndexOf('.');
|
final int i = name.lastIndexOf('.');
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
sm.checkPackageAccess(name.substring(0, i));
|
sm.checkPackageAccess(name.substring(0, i));
|
||||||
return null;
|
return null;
|
||||||
@ -1265,7 +1265,7 @@ public abstract class ClassLoader {
|
|||||||
{
|
{
|
||||||
final Enumeration<Resource> e =
|
final Enumeration<Resource> e =
|
||||||
getBootstrapClassPath().getResources(name);
|
getBootstrapClassPath().getResources(name);
|
||||||
return new Enumeration<URL> () {
|
return new Enumeration<> () {
|
||||||
public URL nextElement() {
|
public URL nextElement() {
|
||||||
return e.nextElement().getURL();
|
return e.nextElement().getURL();
|
||||||
}
|
}
|
||||||
@ -1867,7 +1867,7 @@ public abstract class ClassLoader {
|
|||||||
boolean isBuiltin = (name != null);
|
boolean isBuiltin = (name != null);
|
||||||
if (!isBuiltin) {
|
if (!isBuiltin) {
|
||||||
name = AccessController.doPrivileged(
|
name = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<String>() {
|
new PrivilegedAction<>() {
|
||||||
public String run() {
|
public String run() {
|
||||||
try {
|
try {
|
||||||
return file.exists() ? file.getCanonicalPath() : null;
|
return file.exists() ? file.getCanonicalPath() : null;
|
||||||
|
@ -595,7 +595,7 @@ public class Package implements java.lang.reflect.AnnotatedElement {
|
|||||||
|
|
||||||
CachedManifest(final String fileName) {
|
CachedManifest(final String fileName) {
|
||||||
this.fileName = fileName;
|
this.fileName = fileName;
|
||||||
this.url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
|
this.url = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public URL run() {
|
public URL run() {
|
||||||
final File file = new File(fileName);
|
final File file = new File(fileName);
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
@ -626,7 +626,7 @@ public class Package implements java.lang.reflect.AnnotatedElement {
|
|||||||
if (m != null) {
|
if (m != null) {
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
m = AccessController.doPrivileged(new PrivilegedAction<Manifest>() {
|
m = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Manifest run() {
|
public Manifest run() {
|
||||||
try (FileInputStream fis = new FileInputStream(fileName);
|
try (FileInputStream fis = new FileInputStream(fileName);
|
||||||
JarInputStream jis = new JarInputStream(fis, false)) {
|
JarInputStream jis = new JarInputStream(fis, false)) {
|
||||||
|
@ -1455,7 +1455,7 @@ class SecurityManager {
|
|||||||
if (!packageAccessValid) {
|
if (!packageAccessValid) {
|
||||||
String tmpPropertyStr =
|
String tmpPropertyStr =
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<String>() {
|
new PrivilegedAction<>() {
|
||||||
public String run() {
|
public String run() {
|
||||||
return java.security.Security.getProperty(
|
return java.security.Security.getProperty(
|
||||||
"package.access");
|
"package.access");
|
||||||
@ -1524,7 +1524,7 @@ class SecurityManager {
|
|||||||
if (!packageDefinitionValid) {
|
if (!packageDefinitionValid) {
|
||||||
String tmpPropertyStr =
|
String tmpPropertyStr =
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<String>() {
|
new PrivilegedAction<>() {
|
||||||
public String run() {
|
public String run() {
|
||||||
return java.security.Security.getProperty(
|
return java.security.Security.getProperty(
|
||||||
"package.definition");
|
"package.definition");
|
||||||
|
@ -206,6 +206,7 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -214,6 +215,7 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -222,6 +224,7 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -230,6 +233,7 @@ import java.util.Arrays;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -309,7 +309,7 @@ public final class System {
|
|||||||
// calls the installed security manager's checkPermission method
|
// calls the installed security manager's checkPermission method
|
||||||
// which will loop infinitely if there is a non-system class
|
// which will loop infinitely if there is a non-system class
|
||||||
// (in this case: the new security manager class) on the stack).
|
// (in this case: the new security manager class) on the stack).
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
s.getClass().getProtectionDomain().implies
|
s.getClass().getProtectionDomain().implies
|
||||||
(SecurityConstants.ALL_PERMISSION);
|
(SecurityConstants.ALL_PERMISSION);
|
||||||
|
@ -1661,7 +1661,7 @@ class Thread implements Runnable {
|
|||||||
*/
|
*/
|
||||||
private static boolean auditSubclass(final Class<?> subcl) {
|
private static boolean auditSubclass(final Class<?> subcl) {
|
||||||
Boolean result = AccessController.doPrivileged(
|
Boolean result = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Boolean>() {
|
new PrivilegedAction<>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
for (Class<?> cl = subcl;
|
for (Class<?> cl = subcl;
|
||||||
cl != Thread.class;
|
cl != Thread.class;
|
||||||
|
@ -87,7 +87,7 @@ class InfoFromMemberName implements MethodHandleInfo {
|
|||||||
// For more information see comments on {@link MethodHandleNatives#linkMethod}.
|
// For more information see comments on {@link MethodHandleNatives#linkMethod}.
|
||||||
throw new IllegalArgumentException("cannot reflect signature polymorphic method");
|
throw new IllegalArgumentException("cannot reflect signature polymorphic method");
|
||||||
}
|
}
|
||||||
Member mem = AccessController.doPrivileged(new PrivilegedAction<Member>() {
|
Member mem = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Member run() {
|
public Member run() {
|
||||||
try {
|
try {
|
||||||
return reflectUnchecked();
|
return reflectUnchecked();
|
||||||
|
@ -194,7 +194,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
|||||||
final Class<?> innerClass = spinInnerClass();
|
final Class<?> innerClass = spinInnerClass();
|
||||||
if (invokedType.parameterCount() == 0) {
|
if (invokedType.parameterCount() == 0) {
|
||||||
final Constructor<?>[] ctrs = AccessController.doPrivileged(
|
final Constructor<?>[] ctrs = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Constructor<?>[]>() {
|
new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Constructor<?>[] run() {
|
public Constructor<?>[] run() {
|
||||||
Constructor<?>[] ctrs = innerClass.getDeclaredConstructors();
|
Constructor<?>[] ctrs = innerClass.getDeclaredConstructors();
|
||||||
@ -311,7 +311,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
|||||||
|
|
||||||
// If requested, dump out to a file for debugging purposes
|
// If requested, dump out to a file for debugging purposes
|
||||||
if (dumper != null) {
|
if (dumper != null) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
dumper.dumpClass(lambdaClassName, classBytes);
|
dumper.dumpClass(lambdaClassName, classBytes);
|
||||||
|
@ -167,7 +167,7 @@ class InvokerBytecodeGenerator {
|
|||||||
static void maybeDump(final String className, final byte[] classFile) {
|
static void maybeDump(final String className, final byte[] classFile) {
|
||||||
if (DUMP_CLASS_FILES) {
|
if (DUMP_CLASS_FILES) {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
try {
|
try {
|
||||||
String dumpName = className;
|
String dumpName = className;
|
||||||
|
@ -51,7 +51,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
|||||||
private static final int MAX_ARITY;
|
private static final int MAX_ARITY;
|
||||||
static {
|
static {
|
||||||
final Object[] values = { 255 };
|
final Object[] values = { 255 };
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
values[0] = Integer.getInteger(MethodHandleImpl.class.getName()+".MAX_ARITY", 255);
|
values[0] = Integer.getInteger(MethodHandleImpl.class.getName()+".MAX_ARITY", 255);
|
||||||
@ -1234,7 +1234,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
|
|||||||
private static final byte[] T_BYTES;
|
private static final byte[] T_BYTES;
|
||||||
static {
|
static {
|
||||||
final Object[] values = {null};
|
final Object[] values = {null};
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
try {
|
try {
|
||||||
Class<T> tClass = T.class;
|
Class<T> tClass = T.class;
|
||||||
|
@ -199,7 +199,7 @@ public class MethodHandleProxies {
|
|||||||
// sun.invoke.WrapperInstance is a restricted interface not accessible
|
// sun.invoke.WrapperInstance is a restricted interface not accessible
|
||||||
// by any non-null class loader.
|
// by any non-null class loader.
|
||||||
final ClassLoader loader = proxyLoader;
|
final ClassLoader loader = proxyLoader;
|
||||||
proxy = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
proxy = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
return Proxy.newProxyInstance(
|
return Proxy.newProxyInstance(
|
||||||
loader,
|
loader,
|
||||||
|
@ -53,7 +53,7 @@ import sun.misc.Unsafe;
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
final Object[] values = new Object[9];
|
final Object[] values = new Object[9];
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
|
values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
|
||||||
values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
|
values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
|
||||||
|
@ -64,7 +64,7 @@ final class ProxyClassesDumper {
|
|||||||
try {
|
try {
|
||||||
path = path.trim();
|
path = path.trim();
|
||||||
final Path dir = Paths.get(path.length() == 0 ? "." : path);
|
final Path dir = Paths.get(path.length() == 0 ? "." : path);
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
validateDumpDir(dir);
|
validateDumpDir(dir);
|
||||||
|
@ -218,7 +218,7 @@ public final class SerializedLambda implements Serializable {
|
|||||||
|
|
||||||
private Object readResolve() throws ReflectiveOperationException {
|
private Object readResolve() throws ReflectiveOperationException {
|
||||||
try {
|
try {
|
||||||
Method deserialize = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
|
Method deserialize = AccessController.doPrivileged(new PrivilegedExceptionAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Method run() throws Exception {
|
public Method run() throws Exception {
|
||||||
Method m = capturingClass.getDeclaredMethod("$deserializeLambda$", SerializedLambda.class);
|
Method m = capturingClass.getDeclaredMethod("$deserializeLambda$", SerializedLambda.class);
|
||||||
|
@ -121,7 +121,7 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
|
|||||||
*/
|
*/
|
||||||
private static void forkSecondaryFinalizer(final Runnable proc) {
|
private static void forkSecondaryFinalizer(final Runnable proc) {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Void>() {
|
new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
ThreadGroup tg = Thread.currentThread().getThreadGroup();
|
ThreadGroup tg = Thread.currentThread().getThreadGroup();
|
||||||
for (ThreadGroup tgn = tg;
|
for (ThreadGroup tgn = tg;
|
||||||
|
@ -728,7 +728,7 @@ public class Proxy implements java.io.Serializable {
|
|||||||
|
|
||||||
final Constructor<?> cons = cl.getConstructor(constructorParams);
|
final Constructor<?> cons = cl.getConstructor(constructorParams);
|
||||||
if (!Modifier.isPublic(cl.getModifiers())) {
|
if (!Modifier.isPublic(cl.getModifiers())) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
cons.setAccessible(true);
|
cons.setAccessible(true);
|
||||||
return null;
|
return null;
|
||||||
|
@ -62,7 +62,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
|||||||
*/
|
*/
|
||||||
static {
|
static {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("net");
|
System.loadLibrary("net");
|
||||||
return null;
|
return null;
|
||||||
|
@ -79,7 +79,7 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
|
|||||||
*/
|
*/
|
||||||
static {
|
static {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("net");
|
System.loadLibrary("net");
|
||||||
return null;
|
return null;
|
||||||
|
@ -201,14 +201,13 @@ public class CookieManager extends CookieHandler
|
|||||||
throw new IllegalArgumentException("Argument is null");
|
throw new IllegalArgumentException("Argument is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, List<String>> cookieMap =
|
Map<String, List<String>> cookieMap = new java.util.HashMap<>();
|
||||||
new java.util.HashMap<String, List<String>>();
|
|
||||||
// if there's no default CookieStore, no way for us to get any cookie
|
// if there's no default CookieStore, no way for us to get any cookie
|
||||||
if (cookieJar == null)
|
if (cookieJar == null)
|
||||||
return Collections.unmodifiableMap(cookieMap);
|
return Collections.unmodifiableMap(cookieMap);
|
||||||
|
|
||||||
boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
|
boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
|
||||||
List<HttpCookie> cookies = new java.util.ArrayList<HttpCookie>();
|
List<HttpCookie> cookies = new java.util.ArrayList<>();
|
||||||
String path = uri.getPath();
|
String path = uri.getPath();
|
||||||
if (path == null || path.isEmpty()) {
|
if (path == null || path.isEmpty()) {
|
||||||
path = "/";
|
path = "/";
|
||||||
@ -411,7 +410,7 @@ public class CookieManager extends CookieHandler
|
|||||||
private List<String> sortByPath(List<HttpCookie> cookies) {
|
private List<String> sortByPath(List<HttpCookie> cookies) {
|
||||||
Collections.sort(cookies, new CookiePathComparator());
|
Collections.sort(cookies, new CookiePathComparator());
|
||||||
|
|
||||||
List<String> cookieHeader = new java.util.ArrayList<String>();
|
List<String> cookieHeader = new java.util.ArrayList<>();
|
||||||
for (HttpCookie cookie : cookies) {
|
for (HttpCookie cookie : cookies) {
|
||||||
// Netscape cookie spec and RFC 2965 have different format of Cookie
|
// Netscape cookie spec and RFC 2965 have different format of Cookie
|
||||||
// header; RFC 2965 requires a leading $Version="1" string while Netscape
|
// header; RFC 2965 requires a leading $Version="1" string while Netscape
|
||||||
|
@ -47,7 +47,7 @@ class DatagramPacket {
|
|||||||
*/
|
*/
|
||||||
static {
|
static {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("net");
|
System.loadLibrary("net");
|
||||||
return null;
|
return null;
|
||||||
|
@ -308,7 +308,7 @@ class DatagramSocket implements java.io.Closeable {
|
|||||||
// getDeclaredMethod, therefore we need permission to access the member
|
// getDeclaredMethod, therefore we need permission to access the member
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Void>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws NoSuchMethodException {
|
public Void run() throws NoSuchMethodException {
|
||||||
Class<?>[] cl = new Class<?>[1];
|
Class<?>[] cl = new Class<?>[1];
|
||||||
cl[0] = DatagramPacket.class;
|
cl[0] = DatagramPacket.class;
|
||||||
|
@ -64,7 +64,7 @@ import java.util.Set;
|
|||||||
serverSocketField = netClientClazz.getDeclaredField("serverSocket");
|
serverSocketField = netClientClazz.getDeclaredField("serverSocket");
|
||||||
|
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
httpField.setAccessible(true);
|
httpField.setAccessible(true);
|
||||||
serverSocketField.setAccessible(true);
|
serverSocketField.setAccessible(true);
|
||||||
@ -146,7 +146,7 @@ import java.util.Set;
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return java.security.AccessController.doPrivileged(
|
return java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<Socket>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public Socket run() throws IOException {
|
public Socket run() throws IOException {
|
||||||
return doTunnel(urlString, timeout);
|
return doTunnel(urlString, timeout);
|
||||||
}
|
}
|
||||||
|
@ -1125,7 +1125,7 @@ public final class HttpCookie implements Cloneable {
|
|||||||
* @return list of strings; never null
|
* @return list of strings; never null
|
||||||
*/
|
*/
|
||||||
private static List<String> splitMultiCookies(String header) {
|
private static List<String> splitMultiCookies(String header) {
|
||||||
List<String> cookies = new java.util.ArrayList<String>();
|
List<String> cookies = new java.util.ArrayList<>();
|
||||||
int quoteCount = 0;
|
int quoteCount = 0;
|
||||||
int p, q;
|
int p, q;
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public final class IDN {
|
|||||||
try {
|
try {
|
||||||
final String IDN_PROFILE = "uidna.spp";
|
final String IDN_PROFILE = "uidna.spp";
|
||||||
if (System.getSecurityManager() != null) {
|
if (System.getSecurityManager() != null) {
|
||||||
stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
|
stream = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public InputStream run() {
|
public InputStream run() {
|
||||||
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
return StringPrep.class.getResourceAsStream(IDN_PROFILE);
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,9 @@ class InMemoryCookieStore implements CookieStore {
|
|||||||
* The default ctor
|
* The default ctor
|
||||||
*/
|
*/
|
||||||
public InMemoryCookieStore() {
|
public InMemoryCookieStore() {
|
||||||
cookieJar = new ArrayList<HttpCookie>();
|
cookieJar = new ArrayList<>();
|
||||||
domainIndex = new HashMap<String, List<HttpCookie>>();
|
domainIndex = new HashMap<>();
|
||||||
uriIndex = new HashMap<URI, List<HttpCookie>>();
|
uriIndex = new HashMap<>();
|
||||||
|
|
||||||
lock = new ReentrantLock(false);
|
lock = new ReentrantLock(false);
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ class InMemoryCookieStore implements CookieStore {
|
|||||||
throw new NullPointerException("uri is null");
|
throw new NullPointerException("uri is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<HttpCookie> cookies = new ArrayList<HttpCookie>();
|
List<HttpCookie> cookies = new ArrayList<>();
|
||||||
boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
|
boolean secureLink = "https".equalsIgnoreCase(uri.getScheme());
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -157,7 +157,7 @@ class InMemoryCookieStore implements CookieStore {
|
|||||||
* of this cookie store.
|
* of this cookie store.
|
||||||
*/
|
*/
|
||||||
public List<URI> getURIs() {
|
public List<URI> getURIs() {
|
||||||
List<URI> uris = new ArrayList<URI>();
|
List<URI> uris = new ArrayList<>();
|
||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
@ -281,7 +281,7 @@ class InMemoryCookieStore implements CookieStore {
|
|||||||
String host, boolean secureLink) {
|
String host, boolean secureLink) {
|
||||||
// Use a separate list to handle cookies that need to be removed so
|
// Use a separate list to handle cookies that need to be removed so
|
||||||
// that there is no conflict with iterators.
|
// that there is no conflict with iterators.
|
||||||
ArrayList<HttpCookie> toRemove = new ArrayList<HttpCookie>();
|
ArrayList<HttpCookie> toRemove = new ArrayList<>();
|
||||||
for (Map.Entry<String, List<HttpCookie>> entry : cookieIndex.entrySet()) {
|
for (Map.Entry<String, List<HttpCookie>> entry : cookieIndex.entrySet()) {
|
||||||
String domain = entry.getKey();
|
String domain = entry.getKey();
|
||||||
List<HttpCookie> lst = entry.getValue();
|
List<HttpCookie> lst = entry.getValue();
|
||||||
@ -368,7 +368,7 @@ class InMemoryCookieStore implements CookieStore {
|
|||||||
|
|
||||||
cookies.add(cookie);
|
cookies.add(cookie);
|
||||||
} else {
|
} else {
|
||||||
cookies = new ArrayList<HttpCookie>();
|
cookies = new ArrayList<>();
|
||||||
cookies.add(cookie);
|
cookies.add(cookie);
|
||||||
indexStore.put(index, cookies);
|
indexStore.put(index, cookies);
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ class InetAddress implements java.io.Serializable {
|
|||||||
preferIPv6Address = java.security.AccessController.doPrivileged(
|
preferIPv6Address = java.security.AccessController.doPrivileged(
|
||||||
new GetBooleanAction("java.net.preferIPv6Addresses")).booleanValue();
|
new GetBooleanAction("java.net.preferIPv6Addresses")).booleanValue();
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("net");
|
System.loadLibrary("net");
|
||||||
return null;
|
return null;
|
||||||
@ -852,7 +852,7 @@ class InetAddress implements java.io.Serializable {
|
|||||||
final String providerName = provider;
|
final String providerName = provider;
|
||||||
try {
|
try {
|
||||||
nameService = java.security.AccessController.doPrivileged(
|
nameService = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<NameService>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public NameService run() {
|
public NameService run() {
|
||||||
Iterator<NameServiceDescriptor> itr =
|
Iterator<NameServiceDescriptor> itr =
|
||||||
ServiceLoader.load(NameServiceDescriptor.class)
|
ServiceLoader.load(NameServiceDescriptor.class)
|
||||||
@ -892,7 +892,7 @@ class InetAddress implements java.io.Serializable {
|
|||||||
String provider = null;;
|
String provider = null;;
|
||||||
String propPrefix = "sun.net.spi.nameservice.provider.";
|
String propPrefix = "sun.net.spi.nameservice.provider.";
|
||||||
int n = 1;
|
int n = 1;
|
||||||
nameServices = new ArrayList<NameService>();
|
nameServices = new ArrayList<>();
|
||||||
provider = AccessController.doPrivileged(
|
provider = AccessController.doPrivileged(
|
||||||
new GetPropertyAction(propPrefix + n));
|
new GetPropertyAction(propPrefix + n));
|
||||||
while (provider != null) {
|
while (provider != null) {
|
||||||
|
@ -54,7 +54,7 @@ public final class NetworkInterface {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.loadLibrary("net");
|
System.loadLibrary("net");
|
||||||
return null;
|
return null;
|
||||||
@ -167,7 +167,7 @@ public final class NetworkInterface {
|
|||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
public java.util.List<InterfaceAddress> getInterfaceAddresses() {
|
public java.util.List<InterfaceAddress> getInterfaceAddresses() {
|
||||||
java.util.List<InterfaceAddress> lst = new java.util.ArrayList<InterfaceAddress>(1);
|
java.util.List<InterfaceAddress> lst = new java.util.ArrayList<>(1);
|
||||||
SecurityManager sec = System.getSecurityManager();
|
SecurityManager sec = System.getSecurityManager();
|
||||||
for (int j=0; j<bindings.length; j++) {
|
for (int j=0; j<bindings.length; j++) {
|
||||||
try {
|
try {
|
||||||
@ -346,7 +346,7 @@ public final class NetworkInterface {
|
|||||||
if (netifs == null)
|
if (netifs == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new Enumeration<NetworkInterface>() {
|
return new Enumeration<>() {
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
public NetworkInterface nextElement() {
|
public NetworkInterface nextElement() {
|
||||||
if (netifs != null && i < netifs.length) {
|
if (netifs != null && i < netifs.length) {
|
||||||
|
@ -470,7 +470,7 @@ class Socket implements java.io.Closeable {
|
|||||||
// getDeclaredMethod, therefore we need permission to access the member
|
// getDeclaredMethod, therefore we need permission to access the member
|
||||||
|
|
||||||
oldImpl = AccessController.doPrivileged
|
oldImpl = AccessController.doPrivileged
|
||||||
(new PrivilegedAction<Boolean>() {
|
(new PrivilegedAction<>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
Class<?> clazz = impl.getClass();
|
Class<?> clazz = impl.getClass();
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -911,7 +911,7 @@ class Socket implements java.io.Closeable {
|
|||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
is = AccessController.doPrivileged(
|
is = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<InputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public InputStream run() throws IOException {
|
public InputStream run() throws IOException {
|
||||||
return impl.getInputStream();
|
return impl.getInputStream();
|
||||||
}
|
}
|
||||||
@ -951,7 +951,7 @@ class Socket implements java.io.Closeable {
|
|||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
try {
|
try {
|
||||||
os = AccessController.doPrivileged(
|
os = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<OutputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public OutputStream run() throws IOException {
|
public OutputStream run() throws IOException {
|
||||||
return impl.getOutputStream();
|
return impl.getOutputStream();
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1194,7 @@ public final class SocketPermission extends Permission
|
|||||||
*/
|
*/
|
||||||
private static int initEphemeralPorts(String suffix, int defval) {
|
private static int initEphemeralPorts(String suffix, int defval) {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Integer>(){
|
new PrivilegedAction<>(){
|
||||||
public Integer run() {
|
public Integer run() {
|
||||||
int val = Integer.getInteger(
|
int val = Integer.getInteger(
|
||||||
"jdk.net.ephemeralPortRange."+suffix, -1
|
"jdk.net.ephemeralPortRange."+suffix, -1
|
||||||
@ -1328,7 +1328,7 @@ final class SocketPermissionCollection extends PermissionCollection
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public SocketPermissionCollection() {
|
public SocketPermissionCollection() {
|
||||||
perms = new ArrayList<SocketPermission>();
|
perms = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1466,7 +1466,7 @@ final class SocketPermissionCollection extends PermissionCollection
|
|||||||
// Get the one we want
|
// Get the one we want
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Vector<SocketPermission> permissions = (Vector<SocketPermission>)gfields.get("permissions", null);
|
Vector<SocketPermission> permissions = (Vector<SocketPermission>)gfields.get("permissions", null);
|
||||||
perms = new ArrayList<SocketPermission>(permissions.size());
|
perms = new ArrayList<>(permissions.size());
|
||||||
perms.addAll(permissions);
|
perms.addAll(permissions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<Void>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws IOException {
|
public Void run() throws IOException {
|
||||||
superConnectServer(host, port, timeout);
|
superConnectServer(host, port, timeout);
|
||||||
cmdIn = getInputStream();
|
cmdIn = getInputStream();
|
||||||
@ -157,7 +157,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
final InetAddress addr = InetAddress.getByName(server);
|
final InetAddress addr = InetAddress.getByName(server);
|
||||||
PasswordAuthentication pw =
|
PasswordAuthentication pw =
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<PasswordAuthentication>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public PasswordAuthentication run() {
|
public PasswordAuthentication run() {
|
||||||
return Authenticator.requestPasswordAuthentication(
|
return Authenticator.requestPasswordAuthentication(
|
||||||
server, addr, serverPort, "SOCKS5", "SOCKS authentication", null);
|
server, addr, serverPort, "SOCKS5", "SOCKS authentication", null);
|
||||||
@ -351,7 +351,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
// server is not null only when the socket was created with a
|
// server is not null only when the socket was created with a
|
||||||
// specified proxy in which case it does bypass the ProxySelector
|
// specified proxy in which case it does bypass the ProxySelector
|
||||||
ProxySelector sel = java.security.AccessController.doPrivileged(
|
ProxySelector sel = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<ProxySelector>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public ProxySelector run() {
|
public ProxySelector run() {
|
||||||
return ProxySelector.getDefault();
|
return ProxySelector.getDefault();
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
InetAddress naddr = baddr;
|
InetAddress naddr = baddr;
|
||||||
if (naddr.isAnyLocalAddress()) {
|
if (naddr.isAnyLocalAddress()) {
|
||||||
naddr = AccessController.doPrivileged(
|
naddr = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<InetAddress>() {
|
new PrivilegedAction<>() {
|
||||||
public InetAddress run() {
|
public InetAddress run() {
|
||||||
return cmdsock.getLocalAddress();
|
return cmdsock.getLocalAddress();
|
||||||
|
|
||||||
@ -671,7 +671,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
// server is not null only when the socket was created with a
|
// server is not null only when the socket was created with a
|
||||||
// specified proxy in which case it does bypass the ProxySelector
|
// specified proxy in which case it does bypass the ProxySelector
|
||||||
ProxySelector sel = java.security.AccessController.doPrivileged(
|
ProxySelector sel = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<ProxySelector>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public ProxySelector run() {
|
public ProxySelector run() {
|
||||||
return ProxySelector.getDefault();
|
return ProxySelector.getDefault();
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
// Connects to the SOCKS server
|
// Connects to the SOCKS server
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Void>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
cmdsock = new Socket(new PlainSocketImpl());
|
cmdsock = new Socket(new PlainSocketImpl());
|
||||||
cmdsock.connect(new InetSocketAddress(server, serverPort));
|
cmdsock.connect(new InetSocketAddress(server, serverPort));
|
||||||
@ -755,7 +755,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Void>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws Exception {
|
public Void run() throws Exception {
|
||||||
cmdsock = new Socket(new PlainSocketImpl());
|
cmdsock = new Socket(new PlainSocketImpl());
|
||||||
cmdsock.connect(new InetSocketAddress(server, serverPort));
|
cmdsock.connect(new InetSocketAddress(server, serverPort));
|
||||||
|
@ -268,6 +268,23 @@ public final class URL implements java.io.Serializable {
|
|||||||
* createURLStreamHandler} method of each provider, if instantiated, is
|
* createURLStreamHandler} method of each provider, if instantiated, is
|
||||||
* invoked, with the protocol string, until a provider returns non-null,
|
* invoked, with the protocol string, until a provider returns non-null,
|
||||||
* or all providers have been exhausted.
|
* or all providers have been exhausted.
|
||||||
|
* <li>If the previous step fails to find a protocol handler, the
|
||||||
|
* constructor reads the value of the system property:
|
||||||
|
* <blockquote>{@code
|
||||||
|
* java.protocol.handler.pkgs
|
||||||
|
* }</blockquote>
|
||||||
|
* If the value of that system property is not {@code null},
|
||||||
|
* it is interpreted as a list of packages separated by a vertical
|
||||||
|
* slash character '{@code |}'. The constructor tries to load
|
||||||
|
* the class named:
|
||||||
|
* <blockquote>{@code
|
||||||
|
* <package>.<protocol>.Handler
|
||||||
|
* }</blockquote>
|
||||||
|
* where {@code <package>} is replaced by the name of the package
|
||||||
|
* and {@code <protocol>} is replaced by the name of the protocol.
|
||||||
|
* If this class does not exist, or if the class exists but it is not
|
||||||
|
* a subclass of {@code URLStreamHandler}, then the next package
|
||||||
|
* in the list is tried.
|
||||||
* <li>If the previous step fails to find a protocol handler, then the
|
* <li>If the previous step fails to find a protocol handler, then the
|
||||||
* constructor tries to load a built-in protocol handler.
|
* constructor tries to load a built-in protocol handler.
|
||||||
* If this class does not exist, or if the class exists but it is not a
|
* If this class does not exist, or if the class exists but it is not a
|
||||||
@ -1139,8 +1156,41 @@ public final class URL implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static URLStreamHandler lookupViaProperty(String protocol) {
|
||||||
|
String packagePrefixList = java.security.AccessController.doPrivileged(
|
||||||
|
new PrivilegedAction<>() {
|
||||||
|
public String run() {
|
||||||
|
return System.getProperty(protocolPathProp, "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
String[] packagePrefixes = packagePrefixList.split("\\|");
|
||||||
|
|
||||||
|
URLStreamHandler handler = null;
|
||||||
|
for (int i=0; handler == null && i<packagePrefixes.length; i++) {
|
||||||
|
String packagePrefix = packagePrefixes[i].trim();
|
||||||
|
try {
|
||||||
|
String clsName = packagePrefix + "." + protocol + ".Handler";
|
||||||
|
Class<?> cls = null;
|
||||||
|
try {
|
||||||
|
cls = Class.forName(clsName);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||||
|
if (cl != null) {
|
||||||
|
cls = cl.loadClass(clsName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cls != null) {
|
||||||
|
handler = (URLStreamHandler)cls.newInstance();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// any number of exceptions can get thrown here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
private static Iterator<URLStreamHandlerProvider> providers() {
|
private static Iterator<URLStreamHandlerProvider> providers() {
|
||||||
return new Iterator<URLStreamHandlerProvider>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||||
ServiceLoader<URLStreamHandlerProvider> sl =
|
ServiceLoader<URLStreamHandlerProvider> sl =
|
||||||
@ -1193,7 +1243,7 @@ public final class URL implements java.io.Serializable {
|
|||||||
gate.set(gate);
|
gate.set(gate);
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<URLStreamHandler>() {
|
new PrivilegedAction<>() {
|
||||||
public URLStreamHandler run() {
|
public URLStreamHandler run() {
|
||||||
Iterator<URLStreamHandlerProvider> itr = providers();
|
Iterator<URLStreamHandlerProvider> itr = providers();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
@ -1251,6 +1301,10 @@ public final class URL implements java.io.Serializable {
|
|||||||
if (handler == null && !protocol.equalsIgnoreCase("jar")) {
|
if (handler == null && !protocol.equalsIgnoreCase("jar")) {
|
||||||
handler = lookupViaProviders(protocol);
|
handler = lookupViaProviders(protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handler == null) {
|
||||||
|
handler = lookupViaProperty(protocol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (streamHandlerLock) {
|
synchronized (streamHandlerLock) {
|
||||||
|
@ -359,7 +359,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
final Class<?> result;
|
final Class<?> result;
|
||||||
try {
|
try {
|
||||||
result = AccessController.doPrivileged(
|
result = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Class<?>>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Class<?> run() throws ClassNotFoundException {
|
public Class<?> run() throws ClassNotFoundException {
|
||||||
String path = name.replace('.', '/').concat(".class");
|
String path = name.replace('.', '/').concat(".class");
|
||||||
Resource res = ucp.getResource(path, false);
|
Resource res = ucp.getResource(path, false);
|
||||||
@ -564,7 +564,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
* The same restriction to finding classes applies to resources
|
* The same restriction to finding classes applies to resources
|
||||||
*/
|
*/
|
||||||
URL url = AccessController.doPrivileged(
|
URL url = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<URL>() {
|
new PrivilegedAction<>() {
|
||||||
public URL run() {
|
public URL run() {
|
||||||
return ucp.findResource(name, true);
|
return ucp.findResource(name, true);
|
||||||
}
|
}
|
||||||
@ -587,7 +587,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
{
|
{
|
||||||
final Enumeration<URL> e = ucp.findResources(name, true);
|
final Enumeration<URL> e = ucp.findResources(name, true);
|
||||||
|
|
||||||
return new Enumeration<URL>() {
|
return new Enumeration<>() {
|
||||||
private URL url = null;
|
private URL url = null;
|
||||||
|
|
||||||
private boolean next() {
|
private boolean next() {
|
||||||
@ -596,7 +596,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
URL u = AccessController.doPrivileged(
|
URL u = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<URL>() {
|
new PrivilegedAction<>() {
|
||||||
public URL run() {
|
public URL run() {
|
||||||
if (!e.hasMoreElements())
|
if (!e.hasMoreElements())
|
||||||
return null;
|
return null;
|
||||||
@ -704,7 +704,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
final SecurityManager sm = System.getSecurityManager();
|
final SecurityManager sm = System.getSecurityManager();
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
final Permission fp = p;
|
final Permission fp = p;
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() throws SecurityException {
|
public Void run() throws SecurityException {
|
||||||
sm.checkPermission(fp);
|
sm.checkPermission(fp);
|
||||||
return null;
|
return null;
|
||||||
@ -735,7 +735,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
final AccessControlContext acc = AccessController.getContext();
|
final AccessControlContext acc = AccessController.getContext();
|
||||||
// Need a privileged block to create the class loader
|
// Need a privileged block to create the class loader
|
||||||
URLClassLoader ucl = AccessController.doPrivileged(
|
URLClassLoader ucl = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<URLClassLoader>() {
|
new PrivilegedAction<>() {
|
||||||
public URLClassLoader run() {
|
public URLClassLoader run() {
|
||||||
return new FactoryURLClassLoader(urls, parent, acc);
|
return new FactoryURLClassLoader(urls, parent, acc);
|
||||||
}
|
}
|
||||||
@ -760,7 +760,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
|||||||
final AccessControlContext acc = AccessController.getContext();
|
final AccessControlContext acc = AccessController.getContext();
|
||||||
// Need a privileged block to create the class loader
|
// Need a privileged block to create the class loader
|
||||||
URLClassLoader ucl = AccessController.doPrivileged(
|
URLClassLoader ucl = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<URLClassLoader>() {
|
new PrivilegedAction<>() {
|
||||||
public URLClassLoader run() {
|
public URLClassLoader run() {
|
||||||
return new FactoryURLClassLoader(urls, acc);
|
return new FactoryURLClassLoader(urls, acc);
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ public abstract class AsynchronousFileChannel
|
|||||||
public static AsynchronousFileChannel open(Path file, OpenOption... options)
|
public static AsynchronousFileChannel open(Path file, OpenOption... options)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Set<OpenOption> set = new HashSet<OpenOption>(options.length);
|
Set<OpenOption> set = new HashSet<>(options.length);
|
||||||
Collections.addAll(set, options);
|
Collections.addAll(set, options);
|
||||||
return open(file, set, null, NO_ATTRIBUTES);
|
return open(file, set, null, NO_ATTRIBUTES);
|
||||||
}
|
}
|
||||||
|
@ -330,7 +330,7 @@ public abstract class FileChannel
|
|||||||
public static FileChannel open(Path path, OpenOption... options)
|
public static FileChannel open(Path path, OpenOption... options)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Set<OpenOption> set = new HashSet<OpenOption>(options.length);
|
Set<OpenOption> set = new HashSet<>(options.length);
|
||||||
Collections.addAll(set, options);
|
Collections.addAll(set, options);
|
||||||
return open(path, set, NO_ATTRIBUTES);
|
return open(path, set, NO_ATTRIBUTES);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public abstract class AsynchronousChannelProvider {
|
|||||||
|
|
||||||
private static AsynchronousChannelProvider load() {
|
private static AsynchronousChannelProvider load() {
|
||||||
return AccessController
|
return AccessController
|
||||||
.doPrivileged(new PrivilegedAction<AsynchronousChannelProvider>() {
|
.doPrivileged(new PrivilegedAction<>() {
|
||||||
public AsynchronousChannelProvider run() {
|
public AsynchronousChannelProvider run() {
|
||||||
AsynchronousChannelProvider p;
|
AsynchronousChannelProvider p;
|
||||||
p = loadProviderFromProperty();
|
p = loadProviderFromProperty();
|
||||||
|
@ -172,7 +172,7 @@ public abstract class SelectorProvider {
|
|||||||
if (provider != null)
|
if (provider != null)
|
||||||
return provider;
|
return provider;
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<SelectorProvider>() {
|
new PrivilegedAction<>() {
|
||||||
public SelectorProvider run() {
|
public SelectorProvider run() {
|
||||||
if (loadProviderFromProperty())
|
if (loadProviderFromProperty())
|
||||||
return provider;
|
return provider;
|
||||||
|
@ -335,7 +335,7 @@ public abstract class Charset
|
|||||||
// thrown. Should be invoked with full privileges.
|
// thrown. Should be invoked with full privileges.
|
||||||
//
|
//
|
||||||
private static Iterator<CharsetProvider> providers() {
|
private static Iterator<CharsetProvider> providers() {
|
||||||
return new Iterator<CharsetProvider>() {
|
return new Iterator<>() {
|
||||||
|
|
||||||
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
ClassLoader cl = ClassLoader.getSystemClassLoader();
|
||||||
ServiceLoader<CharsetProvider> sl =
|
ServiceLoader<CharsetProvider> sl =
|
||||||
@ -404,7 +404,7 @@ public abstract class Charset
|
|||||||
gate.set(gate);
|
gate.set(gate);
|
||||||
|
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Charset>() {
|
new PrivilegedAction<>() {
|
||||||
public Charset run() {
|
public Charset run() {
|
||||||
for (Iterator<CharsetProvider> i = providers();
|
for (Iterator<CharsetProvider> i = providers();
|
||||||
i.hasNext();) {
|
i.hasNext();) {
|
||||||
@ -428,7 +428,7 @@ public abstract class Charset
|
|||||||
// returns ExtendedProvider, if installed
|
// returns ExtendedProvider, if installed
|
||||||
private static CharsetProvider extendedProvider() {
|
private static CharsetProvider extendedProvider() {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<CharsetProvider>() {
|
new PrivilegedAction<>() {
|
||||||
public CharsetProvider run() {
|
public CharsetProvider run() {
|
||||||
try {
|
try {
|
||||||
Class<?> epc
|
Class<?> epc
|
||||||
@ -570,10 +570,10 @@ public abstract class Charset
|
|||||||
*/
|
*/
|
||||||
public static SortedMap<String,Charset> availableCharsets() {
|
public static SortedMap<String,Charset> availableCharsets() {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<SortedMap<String,Charset>>() {
|
new PrivilegedAction<>() {
|
||||||
public SortedMap<String,Charset> run() {
|
public SortedMap<String,Charset> run() {
|
||||||
TreeMap<String,Charset> m =
|
TreeMap<String,Charset> m =
|
||||||
new TreeMap<String,Charset>(
|
new TreeMap<>(
|
||||||
ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
|
||||||
put(standardProvider.charsets(), m);
|
put(standardProvider.charsets(), m);
|
||||||
CharsetProvider ecp = ExtendedProviderHolder.extendedProvider;
|
CharsetProvider ecp = ExtendedProviderHolder.extendedProvider;
|
||||||
@ -663,7 +663,7 @@ public abstract class Charset
|
|||||||
if (aliasSet != null)
|
if (aliasSet != null)
|
||||||
return aliasSet;
|
return aliasSet;
|
||||||
int n = aliases.length;
|
int n = aliases.length;
|
||||||
HashSet<String> hs = new HashSet<String>(n);
|
HashSet<String> hs = new HashSet<>(n);
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
hs.add(aliases[i]);
|
hs.add(aliases[i]);
|
||||||
aliasSet = Collections.unmodifiableSet(hs);
|
aliasSet = Collections.unmodifiableSet(hs);
|
||||||
|
@ -204,13 +204,13 @@ public class CoderResult {
|
|||||||
WeakReference<CoderResult> w;
|
WeakReference<CoderResult> w;
|
||||||
CoderResult e = null;
|
CoderResult e = null;
|
||||||
if (cache == null) {
|
if (cache == null) {
|
||||||
cache = new HashMap<Integer,WeakReference<CoderResult>>();
|
cache = new HashMap<>();
|
||||||
} else if ((w = cache.get(k)) != null) {
|
} else if ((w = cache.get(k)) != null) {
|
||||||
e = w.get();
|
e = w.get();
|
||||||
}
|
}
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
e = create(len);
|
e = create(len);
|
||||||
cache.put(k, new WeakReference<CoderResult>(e));
|
cache.put(k, new WeakReference<>(e));
|
||||||
}
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public final class FileSystems {
|
|||||||
private static FileSystem defaultFileSystem() {
|
private static FileSystem defaultFileSystem() {
|
||||||
// load default provider
|
// load default provider
|
||||||
FileSystemProvider provider = AccessController
|
FileSystemProvider provider = AccessController
|
||||||
.doPrivileged(new PrivilegedAction<FileSystemProvider>() {
|
.doPrivileged(new PrivilegedAction<>() {
|
||||||
public FileSystemProvider run() {
|
public FileSystemProvider run() {
|
||||||
return getDefaultProvider();
|
return getDefaultProvider();
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ public final class Files {
|
|||||||
public static SeekableByteChannel newByteChannel(Path path, OpenOption... options)
|
public static SeekableByteChannel newByteChannel(Path path, OpenOption... options)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
Set<OpenOption> set = new HashSet<OpenOption>(options.length);
|
Set<OpenOption> set = new HashSet<>(options.length);
|
||||||
Collections.addAll(set, options);
|
Collections.addAll(set, options);
|
||||||
return newByteChannel(path, set);
|
return newByteChannel(path, set);
|
||||||
}
|
}
|
||||||
@ -516,7 +516,7 @@ public final class Files {
|
|||||||
// create a matcher and return a filter that uses it.
|
// create a matcher and return a filter that uses it.
|
||||||
FileSystem fs = dir.getFileSystem();
|
FileSystem fs = dir.getFileSystem();
|
||||||
final PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
|
final PathMatcher matcher = fs.getPathMatcher("glob:" + glob);
|
||||||
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
|
DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(Path entry) {
|
public boolean accept(Path entry) {
|
||||||
return matcher.matches(entry.getFileName());
|
return matcher.matches(entry.getFileName());
|
||||||
@ -1541,7 +1541,7 @@ public final class Files {
|
|||||||
// creates the default file type detector
|
// creates the default file type detector
|
||||||
private static FileTypeDetector createDefaultFileTypeDetector() {
|
private static FileTypeDetector createDefaultFileTypeDetector() {
|
||||||
return AccessController
|
return AccessController
|
||||||
.doPrivileged(new PrivilegedAction<FileTypeDetector>() {
|
.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override public FileTypeDetector run() {
|
@Override public FileTypeDetector run() {
|
||||||
return sun.nio.fs.DefaultFileTypeDetector.create();
|
return sun.nio.fs.DefaultFileTypeDetector.create();
|
||||||
}});
|
}});
|
||||||
@ -1550,7 +1550,7 @@ public final class Files {
|
|||||||
// loads all installed file type detectors
|
// loads all installed file type detectors
|
||||||
private static List<FileTypeDetector> loadInstalledDetectors() {
|
private static List<FileTypeDetector> loadInstalledDetectors() {
|
||||||
return AccessController
|
return AccessController
|
||||||
.doPrivileged(new PrivilegedAction<List<FileTypeDetector>>() {
|
.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override public List<FileTypeDetector> run() {
|
@Override public List<FileTypeDetector> run() {
|
||||||
List<FileTypeDetector> list = new ArrayList<>();
|
List<FileTypeDetector> list = new ArrayList<>();
|
||||||
ServiceLoader<FileTypeDetector> loader = ServiceLoader
|
ServiceLoader<FileTypeDetector> loader = ServiceLoader
|
||||||
@ -3468,7 +3468,7 @@ public final class Files {
|
|||||||
final Iterator<Path> delegate = ds.iterator();
|
final Iterator<Path> delegate = ds.iterator();
|
||||||
|
|
||||||
// Re-wrap DirectoryIteratorException to UncheckedIOException
|
// Re-wrap DirectoryIteratorException to UncheckedIOException
|
||||||
Iterator<Path> iterator = new Iterator<Path>() {
|
Iterator<Path> iterator = new Iterator<>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
try {
|
try {
|
||||||
|
@ -801,7 +801,7 @@ public interface Path
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
default Iterator<Path> iterator() {
|
default Iterator<Path> iterator() {
|
||||||
return new Iterator<Path>() {
|
return new Iterator<>() {
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -306,7 +306,7 @@ public final class AclEntry {
|
|||||||
* @return the permissions component
|
* @return the permissions component
|
||||||
*/
|
*/
|
||||||
public Set<AclEntryPermission> permissions() {
|
public Set<AclEntryPermission> permissions() {
|
||||||
return new HashSet<AclEntryPermission>(perms);
|
return new HashSet<>(perms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,7 +317,7 @@ public final class AclEntry {
|
|||||||
* @return the flags component
|
* @return the flags component
|
||||||
*/
|
*/
|
||||||
public Set<AclEntryFlag> flags() {
|
public Set<AclEntryFlag> flags() {
|
||||||
return new HashSet<AclEntryFlag>(flags);
|
return new HashSet<>(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,13 +160,13 @@ public final class PosixFilePermissions {
|
|||||||
{
|
{
|
||||||
// copy set and check for nulls (CCE will be thrown if an element is not
|
// copy set and check for nulls (CCE will be thrown if an element is not
|
||||||
// a PosixFilePermission)
|
// a PosixFilePermission)
|
||||||
perms = new HashSet<PosixFilePermission>(perms);
|
perms = new HashSet<>(perms);
|
||||||
for (PosixFilePermission p: perms) {
|
for (PosixFilePermission p: perms) {
|
||||||
if (p == null)
|
if (p == null)
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
final Set<PosixFilePermission> value = perms;
|
final Set<PosixFilePermission> value = perms;
|
||||||
return new FileAttribute<Set<PosixFilePermission>>() {
|
return new FileAttribute<>() {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return "posix:permissions";
|
return "posix:permissions";
|
||||||
|
@ -110,7 +110,7 @@ public abstract class FileSystemProvider {
|
|||||||
|
|
||||||
// loads all installed providers
|
// loads all installed providers
|
||||||
private static List<FileSystemProvider> loadInstalledProviders() {
|
private static List<FileSystemProvider> loadInstalledProviders() {
|
||||||
List<FileSystemProvider> list = new ArrayList<FileSystemProvider>();
|
List<FileSystemProvider> list = new ArrayList<>();
|
||||||
|
|
||||||
ServiceLoader<FileSystemProvider> sl = ServiceLoader
|
ServiceLoader<FileSystemProvider> sl = ServiceLoader
|
||||||
.load(FileSystemProvider.class, ClassLoader.getSystemClassLoader());
|
.load(FileSystemProvider.class, ClassLoader.getSystemClassLoader());
|
||||||
@ -163,7 +163,7 @@ public abstract class FileSystemProvider {
|
|||||||
loadingProviders = true;
|
loadingProviders = true;
|
||||||
|
|
||||||
List<FileSystemProvider> list = AccessController
|
List<FileSystemProvider> list = AccessController
|
||||||
.doPrivileged(new PrivilegedAction<List<FileSystemProvider>>() {
|
.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public List<FileSystemProvider> run() {
|
public List<FileSystemProvider> run() {
|
||||||
return loadInstalledProviders();
|
return loadInstalledProviders();
|
||||||
@ -419,7 +419,7 @@ public abstract class FileSystemProvider {
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
int len = options.length;
|
int len = options.length;
|
||||||
Set<OpenOption> opts = new HashSet<OpenOption>(len + 3);
|
Set<OpenOption> opts = new HashSet<>(len + 3);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
opts.add(StandardOpenOption.CREATE);
|
opts.add(StandardOpenOption.CREATE);
|
||||||
opts.add(StandardOpenOption.TRUNCATE_EXISTING);
|
opts.add(StandardOpenOption.TRUNCATE_EXISTING);
|
||||||
|
@ -399,7 +399,7 @@ final class DateTimeParseContext {
|
|||||||
*/
|
*/
|
||||||
void addChronoChangedListener(Consumer<Chronology> listener) {
|
void addChronoChangedListener(Consumer<Chronology> listener) {
|
||||||
if (chronoListeners == null) {
|
if (chronoListeners == null) {
|
||||||
chronoListeners = new ArrayList<Consumer<Chronology>>();
|
chronoListeners = new ArrayList<>();
|
||||||
}
|
}
|
||||||
chronoListeners.add(listener);
|
chronoListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public abstract class ZoneRulesProvider {
|
|||||||
// if the property java.time.zone.DefaultZoneRulesProvider is
|
// if the property java.time.zone.DefaultZoneRulesProvider is
|
||||||
// set then its value is the class name of the default provider
|
// set then its value is the class name of the default provider
|
||||||
final List<ZoneRulesProvider> loaded = new ArrayList<>();
|
final List<ZoneRulesProvider> loaded = new ArrayList<>();
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Object run() {
|
public Object run() {
|
||||||
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
||||||
if (prop != null) {
|
if (prop != null) {
|
||||||
|
@ -3579,7 +3579,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
|||||||
ZoneInfo zi = null;
|
ZoneInfo zi = null;
|
||||||
try {
|
try {
|
||||||
zi = AccessController.doPrivileged(
|
zi = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<ZoneInfo>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public ZoneInfo run() throws Exception {
|
public ZoneInfo run() throws Exception {
|
||||||
return (ZoneInfo) input.readObject();
|
return (ZoneInfo) input.readObject();
|
||||||
|
@ -212,7 +212,7 @@ public final class Currency implements Serializable {
|
|||||||
private static final int VALID_FORMAT_VERSION = 2;
|
private static final int VALID_FORMAT_VERSION = 2;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -2655,7 +2655,7 @@ public abstract class ResourceBundle {
|
|||||||
InputStream stream = null;
|
InputStream stream = null;
|
||||||
try {
|
try {
|
||||||
stream = AccessController.doPrivileged(
|
stream = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<InputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public InputStream run() throws IOException {
|
public InputStream run() throws IOException {
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
if (reloadFlag) {
|
if (reloadFlag) {
|
||||||
|
@ -678,7 +678,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
|||||||
assert tz != null;
|
assert tz != null;
|
||||||
|
|
||||||
final String id = zoneID;
|
final String id = zoneID;
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
System.setProperty("user.timezone", id);
|
System.setProperty("user.timezone", id);
|
||||||
|
@ -593,7 +593,7 @@ class JarFile extends ZipFile {
|
|||||||
if (includeUnsigned) {
|
if (includeUnsigned) {
|
||||||
return unsignedEntryNames();
|
return unsignedEntryNames();
|
||||||
} else {
|
} else {
|
||||||
return new Enumeration<String>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
public boolean hasMoreElements() {
|
public boolean hasMoreElements() {
|
||||||
return false;
|
return false;
|
||||||
@ -619,7 +619,7 @@ class JarFile extends ZipFile {
|
|||||||
|
|
||||||
// screen out entries which are never signed
|
// screen out entries which are never signed
|
||||||
final Enumeration<? extends ZipEntry> enum_ = super.entries();
|
final Enumeration<? extends ZipEntry> enum_ = super.entries();
|
||||||
return new Enumeration<JarEntry>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
ZipEntry entry;
|
ZipEntry entry;
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ class JarFile extends ZipFile {
|
|||||||
|
|
||||||
private Enumeration<String> unsignedEntryNames() {
|
private Enumeration<String> unsignedEntryNames() {
|
||||||
final Enumeration<JarEntry> entries = entries();
|
final Enumeration<JarEntry> entries = entries();
|
||||||
return new Enumeration<String>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ class JarVerifier {
|
|||||||
final List<CodeSigner[]> signersReq = req;
|
final List<CodeSigner[]> signersReq = req;
|
||||||
final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
|
final Enumeration<String> enum2 = (matchUnsigned) ? unsignedEntryNames(jar) : emptyEnumeration;
|
||||||
|
|
||||||
return new Enumeration<String>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ class JarVerifier {
|
|||||||
final Map<String, CodeSigner[]> map = new HashMap<>();
|
final Map<String, CodeSigner[]> map = new HashMap<>();
|
||||||
map.putAll(signerMap());
|
map.putAll(signerMap());
|
||||||
final Enumeration<? extends ZipEntry> enum_ = e;
|
final Enumeration<? extends ZipEntry> enum_ = e;
|
||||||
return new Enumeration<JarEntry>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
Enumeration<String> signers = null;
|
Enumeration<String> signers = null;
|
||||||
JarEntry entry;
|
JarEntry entry;
|
||||||
@ -786,7 +786,7 @@ class JarVerifier {
|
|||||||
private Enumeration<String> unsignedEntryNames(JarFile jar) {
|
private Enumeration<String> unsignedEntryNames(JarFile jar) {
|
||||||
final Map<String, CodeSigner[]> map = signerMap();
|
final Map<String, CodeSigner[]> map = signerMap();
|
||||||
final Enumeration<JarEntry> entries = jar.entries();
|
final Enumeration<JarEntry> entries = jar.entries();
|
||||||
return new Enumeration<String>() {
|
return new Enumeration<>() {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ public class Cleaner
|
|||||||
try {
|
try {
|
||||||
thunk.run();
|
thunk.run();
|
||||||
} catch (final Throwable x) {
|
} catch (final Throwable x) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
if (System.err != null)
|
if (System.err != null)
|
||||||
new Error("Cleaner terminated abnormally", x)
|
new Error("Cleaner terminated abnormally", x)
|
||||||
|
@ -97,16 +97,16 @@ public class URLClassPath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The original search path of URLs. */
|
/* The original search path of URLs. */
|
||||||
private ArrayList<URL> path = new ArrayList<URL>();
|
private ArrayList<URL> path = new ArrayList<>();
|
||||||
|
|
||||||
/* The stack of unopened URLs */
|
/* The stack of unopened URLs */
|
||||||
Stack<URL> urls = new Stack<URL>();
|
Stack<URL> urls = new Stack<>();
|
||||||
|
|
||||||
/* The resulting search path of Loaders */
|
/* The resulting search path of Loaders */
|
||||||
ArrayList<Loader> loaders = new ArrayList<Loader>();
|
ArrayList<Loader> loaders = new ArrayList<>();
|
||||||
|
|
||||||
/* Map of each URL opened to its corresponding Loader */
|
/* Map of each URL opened to its corresponding Loader */
|
||||||
HashMap<String, Loader> lmap = new HashMap<String, Loader>();
|
HashMap<String, Loader> lmap = new HashMap<>();
|
||||||
|
|
||||||
/* The jar protocol handler to use when creating new URLs */
|
/* The jar protocol handler to use when creating new URLs */
|
||||||
private URLStreamHandler jarHandler;
|
private URLStreamHandler jarHandler;
|
||||||
@ -142,7 +142,7 @@ public class URLClassPath {
|
|||||||
if (closed) {
|
if (closed) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<IOException> result = new LinkedList<IOException>();
|
List<IOException> result = new LinkedList<>();
|
||||||
for (Loader loader : loaders) {
|
for (Loader loader : loaders) {
|
||||||
try {
|
try {
|
||||||
loader.close();
|
loader.close();
|
||||||
@ -234,7 +234,7 @@ public class URLClassPath {
|
|||||||
*/
|
*/
|
||||||
public Enumeration<URL> findResources(final String name,
|
public Enumeration<URL> findResources(final String name,
|
||||||
final boolean check) {
|
final boolean check) {
|
||||||
return new Enumeration<URL>() {
|
return new Enumeration<>() {
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
private URL url = null;
|
private URL url = null;
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ public class URLClassPath {
|
|||||||
*/
|
*/
|
||||||
public Enumeration<Resource> getResources(final String name,
|
public Enumeration<Resource> getResources(final String name,
|
||||||
final boolean check) {
|
final boolean check) {
|
||||||
return new Enumeration<Resource>() {
|
return new Enumeration<>() {
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
private Resource res = null;
|
private Resource res = null;
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ public class URLClassPath {
|
|||||||
private Loader getLoader(final URL url) throws IOException {
|
private Loader getLoader(final URL url) throws IOException {
|
||||||
try {
|
try {
|
||||||
return java.security.AccessController.doPrivileged(
|
return java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<Loader>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public Loader run() throws IOException {
|
public Loader run() throws IOException {
|
||||||
String file = url.getFile();
|
String file = url.getFile();
|
||||||
if (file != null && file.endsWith("/")) {
|
if (file != null && file.endsWith("/")) {
|
||||||
@ -689,7 +689,7 @@ public class URLClassPath {
|
|||||||
if (jar == null) {
|
if (jar == null) {
|
||||||
try {
|
try {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<Void>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws IOException {
|
public Void run() throws IOException {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
System.err.println("Opening " + csu);
|
System.err.println("Opening " + csu);
|
||||||
@ -870,7 +870,7 @@ public class URLClassPath {
|
|||||||
if (index == null)
|
if (index == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
HashSet<String> visited = new HashSet<String>();
|
HashSet<String> visited = new HashSet<>();
|
||||||
return getResource(name, check, visited);
|
return getResource(name, check, visited);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -912,7 +912,7 @@ public class URLClassPath {
|
|||||||
* before
|
* before
|
||||||
*/
|
*/
|
||||||
newLoader = AccessController.doPrivileged(
|
newLoader = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<JarLoader>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public JarLoader run() throws IOException {
|
public JarLoader run() throws IOException {
|
||||||
return new JarLoader(url, handler,
|
return new JarLoader(url, handler,
|
||||||
lmap);
|
lmap);
|
||||||
|
@ -69,7 +69,7 @@ public class NetworkClient {
|
|||||||
final String encs[] = { null };
|
final String encs[] = { null };
|
||||||
|
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Void>() {
|
new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 0).intValue();
|
vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 0).intValue();
|
||||||
vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 0).intValue();
|
vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 0).intValue();
|
||||||
@ -154,7 +154,7 @@ public class NetworkClient {
|
|||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
if (proxy.type() == Proxy.Type.SOCKS) {
|
if (proxy.type() == Proxy.Type.SOCKS) {
|
||||||
s = AccessController.doPrivileged(
|
s = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Socket>() {
|
new PrivilegedAction<>() {
|
||||||
public Socket run() {
|
public Socket run() {
|
||||||
return new Socket(proxy);
|
return new Socket(proxy);
|
||||||
}});
|
}});
|
||||||
@ -201,7 +201,7 @@ public class NetworkClient {
|
|||||||
if (serverSocket == null)
|
if (serverSocket == null)
|
||||||
throw new IOException("not connected");
|
throw new IOException("not connected");
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedAction<InetAddress>() {
|
new PrivilegedAction<>() {
|
||||||
public InetAddress run() {
|
public InetAddress run() {
|
||||||
return serverSocket.getLocalAddress();
|
return serverSocket.getLocalAddress();
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public class ProgressMonitor
|
|||||||
* Return a snapshot of the ProgressSource list
|
* Return a snapshot of the ProgressSource list
|
||||||
*/
|
*/
|
||||||
public ArrayList<ProgressSource> getProgressSources() {
|
public ArrayList<ProgressSource> getProgressSources() {
|
||||||
ArrayList<ProgressSource> snapshot = new ArrayList<ProgressSource>();
|
ArrayList<ProgressSource> snapshot = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
synchronized(progressSourceList) {
|
synchronized(progressSourceList) {
|
||||||
@ -114,7 +114,7 @@ public class ProgressMonitor
|
|||||||
if (progressListenerList.size() > 0)
|
if (progressListenerList.size() > 0)
|
||||||
{
|
{
|
||||||
// Notify progress listener if there is progress change
|
// Notify progress listener if there is progress change
|
||||||
ArrayList<ProgressListener> listeners = new ArrayList<ProgressListener>();
|
ArrayList<ProgressListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
// Copy progress listeners to another list to avoid holding locks
|
// Copy progress listeners to another list to avoid holding locks
|
||||||
synchronized(progressListenerList) {
|
synchronized(progressListenerList) {
|
||||||
@ -151,7 +151,7 @@ public class ProgressMonitor
|
|||||||
if (progressListenerList.size() > 0)
|
if (progressListenerList.size() > 0)
|
||||||
{
|
{
|
||||||
// Notify progress listener if there is progress change
|
// Notify progress listener if there is progress change
|
||||||
ArrayList<ProgressListener> listeners = new ArrayList<ProgressListener>();
|
ArrayList<ProgressListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
// Copy progress listeners to another list to avoid holding locks
|
// Copy progress listeners to another list to avoid holding locks
|
||||||
synchronized(progressListenerList) {
|
synchronized(progressListenerList) {
|
||||||
@ -183,7 +183,7 @@ public class ProgressMonitor
|
|||||||
if (progressListenerList.size() > 0)
|
if (progressListenerList.size() > 0)
|
||||||
{
|
{
|
||||||
// Notify progress listener if there is progress change
|
// Notify progress listener if there is progress change
|
||||||
ArrayList<ProgressListener> listeners = new ArrayList<ProgressListener>();
|
ArrayList<ProgressListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
// Copy progress listeners to another list to avoid holding locks
|
// Copy progress listeners to another list to avoid holding locks
|
||||||
synchronized(progressListenerList) {
|
synchronized(progressListenerList) {
|
||||||
|
@ -244,7 +244,7 @@ class MessageHeader {
|
|||||||
public synchronized Map<String, List<String>> filterAndAddHeaders(
|
public synchronized Map<String, List<String>> filterAndAddHeaders(
|
||||||
String[] excludeList, Map<String, List<String>> include) {
|
String[] excludeList, Map<String, List<String>> include) {
|
||||||
boolean skipIt = false;
|
boolean skipIt = false;
|
||||||
Map<String, List<String>> m = new HashMap<String, List<String>>();
|
Map<String, List<String>> m = new HashMap<>();
|
||||||
for (int i = nkeys; --i >= 0;) {
|
for (int i = nkeys; --i >= 0;) {
|
||||||
if (excludeList != null) {
|
if (excludeList != null) {
|
||||||
// check if the key is in the excludeList.
|
// check if the key is in the excludeList.
|
||||||
@ -260,7 +260,7 @@ class MessageHeader {
|
|||||||
if (!skipIt) {
|
if (!skipIt) {
|
||||||
List<String> l = m.get(keys[i]);
|
List<String> l = m.get(keys[i]);
|
||||||
if (l == null) {
|
if (l == null) {
|
||||||
l = new ArrayList<String>();
|
l = new ArrayList<>();
|
||||||
m.put(keys[i], l);
|
m.put(keys[i], l);
|
||||||
}
|
}
|
||||||
l.add(values[i]);
|
l.add(values[i]);
|
||||||
@ -274,7 +274,7 @@ class MessageHeader {
|
|||||||
for (Map.Entry<String,List<String>> entry: include.entrySet()) {
|
for (Map.Entry<String,List<String>> entry: include.entrySet()) {
|
||||||
List<String> l = m.get(entry.getKey());
|
List<String> l = m.get(entry.getKey());
|
||||||
if (l == null) {
|
if (l == null) {
|
||||||
l = new ArrayList<String>();
|
l = new ArrayList<>();
|
||||||
m.put(entry.getKey(), l);
|
m.put(entry.getKey(), l);
|
||||||
}
|
}
|
||||||
l.addAll(entry.getValue());
|
l.addAll(entry.getValue());
|
||||||
|
@ -64,7 +64,7 @@ public class HttpCapture {
|
|||||||
private static synchronized void init() {
|
private static synchronized void init() {
|
||||||
initialized = true;
|
initialized = true;
|
||||||
String rulesFile = java.security.AccessController.doPrivileged(
|
String rulesFile = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<String>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public String run() {
|
public String run() {
|
||||||
return NetProperties.get("sun.net.http.captureRules");
|
return NetProperties.get("sun.net.http.captureRules");
|
||||||
}
|
}
|
||||||
@ -85,8 +85,8 @@ public class HttpCapture {
|
|||||||
String[] s = line.split(",");
|
String[] s = line.split(",");
|
||||||
if (s.length == 2) {
|
if (s.length == 2) {
|
||||||
if (patterns == null) {
|
if (patterns == null) {
|
||||||
patterns = new ArrayList<Pattern>();
|
patterns = new ArrayList<>();
|
||||||
capFiles = new ArrayList<String>();
|
capFiles = new ArrayList<>();
|
||||||
}
|
}
|
||||||
patterns.add(Pattern.compile(s[0].trim()));
|
patterns.add(Pattern.compile(s[0].trim()));
|
||||||
capFiles.add(s[1].trim());
|
capFiles.add(s[1].trim());
|
||||||
|
@ -479,7 +479,7 @@ public class HttpClient extends NetworkClient {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<Void>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws IOException {
|
public Void run() throws IOException {
|
||||||
openServer(server.getHostString(), server.getPort());
|
openServer(server.getHostString(), server.getPort());
|
||||||
return null;
|
return null;
|
||||||
|
@ -94,7 +94,7 @@ public class KeepAliveCache
|
|||||||
*/
|
*/
|
||||||
final KeepAliveCache cache = this;
|
final KeepAliveCache cache = this;
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
keepAliveTimer = new InnocuousThread(cache, "Keep-Alive-Timer");
|
keepAliveTimer = new InnocuousThread(cache, "Keep-Alive-Timer");
|
||||||
keepAliveTimer.setDaemon(true);
|
keepAliveTimer.setDaemon(true);
|
||||||
@ -178,7 +178,7 @@ public class KeepAliveCache
|
|||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
ArrayList<KeepAliveKey> keysToRemove
|
ArrayList<KeepAliveKey> keysToRemove
|
||||||
= new ArrayList<KeepAliveKey>();
|
= new ArrayList<>();
|
||||||
|
|
||||||
for (KeepAliveKey key : keySet()) {
|
for (KeepAliveKey key : keySet()) {
|
||||||
ClientVector v = get(key);
|
ClientVector v = get(key);
|
||||||
|
@ -122,7 +122,7 @@ public class AuthenticationHeader {
|
|||||||
this.dontUseNegotiate = dontUseNegotiate;
|
this.dontUseNegotiate = dontUseNegotiate;
|
||||||
rsp = response;
|
rsp = response;
|
||||||
this.hdrname = hdrname;
|
this.hdrname = hdrname;
|
||||||
schemes = new HashMap<String,SchemeMapValue>();
|
schemes = new HashMap<>();
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class DigestAuthentication extends AuthenticationInfo {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
Boolean b = AccessController.doPrivileged(
|
Boolean b = AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Boolean>() {
|
new PrivilegedAction<>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
return NetProperties.getBoolean(compatPropName);
|
return NetProperties.getBoolean(compatPropName);
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
new sun.security.action.GetBooleanAction(
|
new sun.security.action.GetBooleanAction(
|
||||||
"sun.net.http.allowRestrictedHeaders")).booleanValue();
|
"sun.net.http.allowRestrictedHeaders")).booleanValue();
|
||||||
if (!allowRestrictedHeaders) {
|
if (!allowRestrictedHeaders) {
|
||||||
restrictedHeaderSet = new HashSet<String>(restrictedHeaders.length);
|
restrictedHeaderSet = new HashSet<>(restrictedHeaders.length);
|
||||||
for (int i=0; i < restrictedHeaders.length; i++) {
|
for (int i=0; i < restrictedHeaders.length; i++) {
|
||||||
restrictedHeaderSet.add(restrictedHeaders[i].toLowerCase());
|
restrictedHeaderSet.add(restrictedHeaders[i].toLowerCase());
|
||||||
}
|
}
|
||||||
@ -413,7 +413,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
final URL url,
|
final URL url,
|
||||||
final RequestorType authType) {
|
final RequestorType authType) {
|
||||||
return java.security.AccessController.doPrivileged(
|
return java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<PasswordAuthentication>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public PasswordAuthentication run() {
|
public PasswordAuthentication run() {
|
||||||
if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
|
if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
|
||||||
logger.finest("Requesting Authentication: host =" + host + " url = " + url);
|
logger.finest("Requesting Authentication: host =" + host + " url = " + url);
|
||||||
@ -817,14 +817,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
} catch (SecurityException se) { /* swallow exception */ }
|
} catch (SecurityException se) { /* swallow exception */ }
|
||||||
} else {
|
} else {
|
||||||
cookieHandler = java.security.AccessController.doPrivileged(
|
cookieHandler = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<CookieHandler>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public CookieHandler run() {
|
public CookieHandler run() {
|
||||||
return CookieHandler.getDefault();
|
return CookieHandler.getDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
cacheHandler = java.security.AccessController.doPrivileged(
|
cacheHandler = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<ResponseCache>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public ResponseCache run() {
|
public ResponseCache run() {
|
||||||
return ResponseCache.getDefault();
|
return ResponseCache.getDefault();
|
||||||
}
|
}
|
||||||
@ -909,7 +909,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
final boolean result[] = {false};
|
final boolean result[] = {false};
|
||||||
|
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<Void>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
try {
|
try {
|
||||||
InetAddress a1 = InetAddress.getByName(h1);
|
InetAddress a1 = InetAddress.getByName(h1);
|
||||||
@ -954,7 +954,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
try {
|
try {
|
||||||
// lookup hostname and use IP address if available
|
// lookup hostname and use IP address if available
|
||||||
host = AccessController.doPrivileged(
|
host = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<String>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public String run() throws IOException {
|
public String run() throws IOException {
|
||||||
InetAddress addr = InetAddress.getByName(hostarg);
|
InetAddress addr = InetAddress.getByName(hostarg);
|
||||||
return addr.getHostAddress();
|
return addr.getHostAddress();
|
||||||
@ -984,7 +984,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Void>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Void run() throws IOException {
|
public Void run() throws IOException {
|
||||||
plainConnect0();
|
plainConnect0();
|
||||||
return null;
|
return null;
|
||||||
@ -1086,7 +1086,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
*/
|
*/
|
||||||
ProxySelector sel =
|
ProxySelector sel =
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedAction<ProxySelector>() {
|
new java.security.PrivilegedAction<>() {
|
||||||
public ProxySelector run() {
|
public ProxySelector run() {
|
||||||
return ProxySelector.getDefault();
|
return ProxySelector.getDefault();
|
||||||
}
|
}
|
||||||
@ -1245,7 +1245,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<OutputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public OutputStream run() throws IOException {
|
public OutputStream run() throws IOException {
|
||||||
return getOutputStream0();
|
return getOutputStream0();
|
||||||
}
|
}
|
||||||
@ -1423,7 +1423,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<InputStream>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public InputStream run() throws IOException {
|
public InputStream run() throws IOException {
|
||||||
return getInputStream0();
|
return getInputStream0();
|
||||||
}
|
}
|
||||||
@ -1877,7 +1877,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
final Object[] args = { rememberedException.getMessage() };
|
final Object[] args = { rememberedException.getMessage() };
|
||||||
IOException chainedException =
|
IOException chainedException =
|
||||||
java.security.AccessController.doPrivileged(
|
java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<IOException>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public IOException run() throws Exception {
|
public IOException run() throws Exception {
|
||||||
return (IOException)
|
return (IOException)
|
||||||
rememberedException.getClass()
|
rememberedException.getClass()
|
||||||
@ -2204,7 +2204,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
try {
|
try {
|
||||||
final String finalHost = host;
|
final String finalHost = host;
|
||||||
addr = java.security.AccessController.doPrivileged(
|
addr = java.security.AccessController.doPrivileged(
|
||||||
new java.security.PrivilegedExceptionAction<InetAddress>() {
|
new java.security.PrivilegedExceptionAction<>() {
|
||||||
public InetAddress run()
|
public InetAddress run()
|
||||||
throws java.net.UnknownHostException {
|
throws java.net.UnknownHostException {
|
||||||
return InetAddress.getByName(finalHost);
|
return InetAddress.getByName(finalHost);
|
||||||
@ -2566,7 +2566,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<Boolean>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public Boolean run() throws IOException {
|
public Boolean run() throws IOException {
|
||||||
return followRedirect0(loc, stat, locUrl0);
|
return followRedirect0(loc, stat, locUrl0);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ public class URLJarFile extends JarFile {
|
|||||||
/* get the stream before asserting privileges */
|
/* get the stream before asserting privileges */
|
||||||
try (final InputStream in = url.openConnection().getInputStream()) {
|
try (final InputStream in = url.openConnection().getInputStream()) {
|
||||||
result = AccessController.doPrivileged(
|
result = AccessController.doPrivileged(
|
||||||
new PrivilegedExceptionAction<JarFile>() {
|
new PrivilegedExceptionAction<>() {
|
||||||
public JarFile run() throws IOException {
|
public JarFile run() throws IOException {
|
||||||
Path tmpFile = Files.createTempFile("jar_cache", null);
|
Path tmpFile = Files.createTempFile("jar_cache", null);
|
||||||
try {
|
try {
|
||||||
|
@ -76,7 +76,7 @@ abstract class AsynchronousChannelGroupImpl
|
|||||||
this.pool = pool;
|
this.pool = pool;
|
||||||
|
|
||||||
if (pool.isFixedThreadPool()) {
|
if (pool.isFixedThreadPool()) {
|
||||||
taskQueue = new ConcurrentLinkedQueue<Runnable>();
|
taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
} else {
|
} else {
|
||||||
taskQueue = null; // not used
|
taskQueue = null; // not used
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ abstract class AsynchronousChannelGroupImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startInternalThread(final Runnable task) {
|
private void startInternalThread(final Runnable task) {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
// internal threads should not be visible to application so
|
// internal threads should not be visible to application so
|
||||||
@ -246,7 +246,7 @@ abstract class AsynchronousChannelGroupImpl
|
|||||||
abstract void shutdownHandlerTasks();
|
abstract void shutdownHandlerTasks();
|
||||||
|
|
||||||
private void shutdownExecutors() {
|
private void shutdownExecutors() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
pool.executor().shutdown();
|
pool.executor().shutdown();
|
||||||
timeoutExecutor.shutdown();
|
timeoutExecutor.shutdown();
|
||||||
@ -323,7 +323,7 @@ abstract class AsynchronousChannelGroupImpl
|
|||||||
task = new Runnable() {
|
task = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Void run() {
|
public Void run() {
|
||||||
delegate.run();
|
delegate.run();
|
||||||
|
@ -228,7 +228,7 @@ abstract class AsynchronousServerSocketChannelImpl
|
|||||||
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
||||||
|
|
||||||
private static Set<SocketOption<?>> defaultOptions() {
|
private static Set<SocketOption<?>> defaultOptions() {
|
||||||
HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
|
HashSet<SocketOption<?>> set = new HashSet<>(2);
|
||||||
set.add(StandardSocketOptions.SO_RCVBUF);
|
set.add(StandardSocketOptions.SO_RCVBUF);
|
||||||
set.add(StandardSocketOptions.SO_REUSEADDR);
|
set.add(StandardSocketOptions.SO_REUSEADDR);
|
||||||
return Collections.unmodifiableSet(set);
|
return Collections.unmodifiableSet(set);
|
||||||
|
@ -503,7 +503,7 @@ abstract class AsynchronousSocketChannelImpl
|
|||||||
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
||||||
|
|
||||||
private static Set<SocketOption<?>> defaultOptions() {
|
private static Set<SocketOption<?>> defaultOptions() {
|
||||||
HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(5);
|
HashSet<SocketOption<?>> set = new HashSet<>(5);
|
||||||
set.add(StandardSocketOptions.SO_SNDBUF);
|
set.add(StandardSocketOptions.SO_SNDBUF);
|
||||||
set.add(StandardSocketOptions.SO_RCVBUF);
|
set.add(StandardSocketOptions.SO_RCVBUF);
|
||||||
set.add(StandardSocketOptions.SO_KEEPALIVE);
|
set.add(StandardSocketOptions.SO_KEEPALIVE);
|
||||||
|
@ -294,7 +294,7 @@ class DatagramChannelImpl
|
|||||||
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
||||||
|
|
||||||
private static Set<SocketOption<?>> defaultOptions() {
|
private static Set<SocketOption<?>> defaultOptions() {
|
||||||
HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
|
HashSet<SocketOption<?>> set = new HashSet<>(8);
|
||||||
set.add(StandardSocketOptions.SO_SNDBUF);
|
set.add(StandardSocketOptions.SO_SNDBUF);
|
||||||
set.add(StandardSocketOptions.SO_RCVBUF);
|
set.add(StandardSocketOptions.SO_RCVBUF);
|
||||||
set.add(StandardSocketOptions.SO_REUSEADDR);
|
set.add(StandardSocketOptions.SO_REUSEADDR);
|
||||||
|
@ -184,7 +184,7 @@ class MembershipKeyImpl
|
|||||||
|
|
||||||
// created blocked set if required and add source address
|
// created blocked set if required and add source address
|
||||||
if (blockedSet == null)
|
if (blockedSet == null)
|
||||||
blockedSet = new HashSet<InetAddress>();
|
blockedSet = new HashSet<>();
|
||||||
blockedSet.add(toBlock);
|
blockedSet.add(toBlock);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -84,13 +84,13 @@ class MembershipRegistry {
|
|||||||
InetAddress group = key.group();
|
InetAddress group = key.group();
|
||||||
List<MembershipKeyImpl> keys;
|
List<MembershipKeyImpl> keys;
|
||||||
if (groups == null) {
|
if (groups == null) {
|
||||||
groups = new HashMap<InetAddress,List<MembershipKeyImpl>>();
|
groups = new HashMap<>();
|
||||||
keys = null;
|
keys = null;
|
||||||
} else {
|
} else {
|
||||||
keys = groups.get(group);
|
keys = groups.get(group);
|
||||||
}
|
}
|
||||||
if (keys == null) {
|
if (keys == null) {
|
||||||
keys = new LinkedList<MembershipKeyImpl>();
|
keys = new LinkedList<>();
|
||||||
groups.put(group, keys);
|
groups.put(group, keys);
|
||||||
}
|
}
|
||||||
keys.add(key);
|
keys.add(key);
|
||||||
|
@ -52,8 +52,8 @@ public abstract class SelectorImpl
|
|||||||
|
|
||||||
protected SelectorImpl(SelectorProvider sp) {
|
protected SelectorImpl(SelectorProvider sp) {
|
||||||
super(sp);
|
super(sp);
|
||||||
keys = new HashSet<SelectionKey>();
|
keys = new HashSet<>();
|
||||||
selectedKeys = new HashSet<SelectionKey>();
|
selectedKeys = new HashSet<>();
|
||||||
if (Util.atBugLevel("1.4")) {
|
if (Util.atBugLevel("1.4")) {
|
||||||
publicKeys = keys;
|
publicKeys = keys;
|
||||||
publicSelectedKeys = selectedKeys;
|
publicSelectedKeys = selectedKeys;
|
||||||
|
@ -182,7 +182,7 @@ class ServerSocketChannelImpl
|
|||||||
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
||||||
|
|
||||||
private static Set<SocketOption<?>> defaultOptions() {
|
private static Set<SocketOption<?>> defaultOptions() {
|
||||||
HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(2);
|
HashSet<SocketOption<?>> set = new HashSet<>(2);
|
||||||
set.add(StandardSocketOptions.SO_RCVBUF);
|
set.add(StandardSocketOptions.SO_RCVBUF);
|
||||||
set.add(StandardSocketOptions.SO_REUSEADDR);
|
set.add(StandardSocketOptions.SO_REUSEADDR);
|
||||||
set.add(StandardSocketOptions.IP_TOS);
|
set.add(StandardSocketOptions.IP_TOS);
|
||||||
|
@ -229,7 +229,7 @@ class SocketChannelImpl
|
|||||||
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
static final Set<SocketOption<?>> defaultOptions = defaultOptions();
|
||||||
|
|
||||||
private static Set<SocketOption<?>> defaultOptions() {
|
private static Set<SocketOption<?>> defaultOptions() {
|
||||||
HashSet<SocketOption<?>> set = new HashSet<SocketOption<?>>(8);
|
HashSet<SocketOption<?>> set = new HashSet<>(8);
|
||||||
set.add(StandardSocketOptions.SO_SNDBUF);
|
set.add(StandardSocketOptions.SO_SNDBUF);
|
||||||
set.add(StandardSocketOptions.SO_RCVBUF);
|
set.add(StandardSocketOptions.SO_RCVBUF);
|
||||||
set.add(StandardSocketOptions.SO_KEEPALIVE);
|
set.add(StandardSocketOptions.SO_KEEPALIVE);
|
||||||
|
@ -135,7 +135,7 @@ public class CharsetMapping {
|
|||||||
|
|
||||||
// init the CharsetMapping object from the .dat binary file
|
// init the CharsetMapping object from the .dat binary file
|
||||||
public static CharsetMapping get(final InputStream is) {
|
public static CharsetMapping get(final InputStream is) {
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<CharsetMapping>() {
|
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public CharsetMapping run() {
|
public CharsetMapping run() {
|
||||||
return new CharsetMapping().load(is);
|
return new CharsetMapping().load(is);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ abstract class AbstractPoller implements Runnable {
|
|||||||
private boolean shutdown;
|
private boolean shutdown;
|
||||||
|
|
||||||
protected AbstractPoller() {
|
protected AbstractPoller() {
|
||||||
this.requestList = new LinkedList<Request>();
|
this.requestList = new LinkedList<>();
|
||||||
this.shutdown = false;
|
this.shutdown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ abstract class AbstractPoller implements Runnable {
|
|||||||
*/
|
*/
|
||||||
public void start() {
|
public void start() {
|
||||||
final Runnable thisRunnable = this;
|
final Runnable thisRunnable = this;
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() {
|
public Object run() {
|
||||||
Thread thr = new ManagedLocalsThread(thisRunnable);
|
Thread thr = new ManagedLocalsThread(thisRunnable);
|
||||||
|
@ -70,8 +70,8 @@ abstract class AbstractWatchKey implements WatchKey {
|
|||||||
this.watcher = watcher;
|
this.watcher = watcher;
|
||||||
this.dir = dir;
|
this.dir = dir;
|
||||||
this.state = State.READY;
|
this.state = State.READY;
|
||||||
this.events = new ArrayList<WatchEvent<?>>();
|
this.events = new ArrayList<>();
|
||||||
this.lastModifyEvents = new HashMap<Object,WatchEvent<?>>();
|
this.lastModifyEvents = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
final AbstractWatchService watcher() {
|
final AbstractWatchService watcher() {
|
||||||
@ -146,7 +146,7 @@ abstract class AbstractWatchKey implements WatchKey {
|
|||||||
|
|
||||||
// non-repeated event
|
// non-repeated event
|
||||||
Event<Object> ev =
|
Event<Object> ev =
|
||||||
new Event<Object>((WatchEvent.Kind<Object>)kind, context);
|
new Event<>((WatchEvent.Kind<Object>)kind, context);
|
||||||
if (isModify) {
|
if (isModify) {
|
||||||
lastModifyEvents.put(context, ev);
|
lastModifyEvents.put(context, ev);
|
||||||
} else if (kind == StandardWatchEventKinds.OVERFLOW) {
|
} else if (kind == StandardWatchEventKinds.OVERFLOW) {
|
||||||
@ -163,7 +163,7 @@ abstract class AbstractWatchKey implements WatchKey {
|
|||||||
public final List<WatchEvent<?>> pollEvents() {
|
public final List<WatchEvent<?>> pollEvents() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
List<WatchEvent<?>> result = events;
|
List<WatchEvent<?>> result = events;
|
||||||
events = new ArrayList<WatchEvent<?>>();
|
events = new ArrayList<>();
|
||||||
lastModifyEvents.clear();
|
lastModifyEvents.clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ public class ReflectionFactory {
|
|||||||
private static void checkInitted() {
|
private static void checkInitted() {
|
||||||
if (initted) return;
|
if (initted) return;
|
||||||
AccessController.doPrivileged(
|
AccessController.doPrivileged(
|
||||||
new PrivilegedAction<Void>() {
|
new PrivilegedAction<>() {
|
||||||
public Void run() {
|
public Void run() {
|
||||||
// Tests to ensure the system properties table is fully
|
// Tests to ensure the system properties table is fully
|
||||||
// initialized. This is needed because reflection code is
|
// initialized. This is needed because reflection code is
|
||||||
|
@ -106,16 +106,16 @@ public class AnnotationType {
|
|||||||
throw new IllegalArgumentException("Not an annotation type");
|
throw new IllegalArgumentException("Not an annotation type");
|
||||||
|
|
||||||
Method[] methods =
|
Method[] methods =
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
|
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||||
public Method[] run() {
|
public Method[] run() {
|
||||||
// Initialize memberTypes and defaultValues
|
// Initialize memberTypes and defaultValues
|
||||||
return annotationClass.getDeclaredMethods();
|
return annotationClass.getDeclaredMethods();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
memberTypes = new HashMap<String,Class<?>>(methods.length+1, 1.0f);
|
memberTypes = new HashMap<>(methods.length+1, 1.0f);
|
||||||
memberDefaults = new HashMap<String, Object>(0);
|
memberDefaults = new HashMap<>(0);
|
||||||
members = new HashMap<String, Method>(methods.length+1, 1.0f);
|
members = new HashMap<>(methods.length+1, 1.0f);
|
||||||
|
|
||||||
for (Method method : methods) {
|
for (Method method : methods) {
|
||||||
if (method.getParameterTypes().length != 0)
|
if (method.getParameterTypes().length != 0)
|
||||||
|
@ -102,8 +102,8 @@ public abstract class Builder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies whether the input certificate completes the path.
|
* Verifies whether the input certificate completes the path.
|
||||||
* When building forward, a trust anchor will complete the path.
|
* When building in the forward direction, a trust anchor will
|
||||||
* When building reverse, the target certificate will complete the path.
|
* complete the path.
|
||||||
*
|
*
|
||||||
* @param cert the certificate to test
|
* @param cert the certificate to test
|
||||||
* @return a boolean value indicating whether the cert completes the path.
|
* @return a boolean value indicating whether the cert completes the path.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
package sun.security.provider.certpath;
|
package sun.security.provider.certpath;
|
||||||
|
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.KeyStore;
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.cert.*;
|
import java.security.cert.*;
|
||||||
import java.security.interfaces.DSAPublicKey;
|
import java.security.interfaces.DSAPublicKey;
|
||||||
@ -194,7 +193,6 @@ class PKIX {
|
|||||||
|
|
||||||
static class BuilderParams extends ValidatorParams {
|
static class BuilderParams extends ValidatorParams {
|
||||||
private PKIXBuilderParameters params;
|
private PKIXBuilderParameters params;
|
||||||
private boolean buildForward = true;
|
|
||||||
private List<CertStore> stores;
|
private List<CertStore> stores;
|
||||||
private X500Principal targetSubject;
|
private X500Principal targetSubject;
|
||||||
|
|
||||||
@ -213,10 +211,6 @@ class PKIX {
|
|||||||
+ "targetCertConstraints parameter must be an "
|
+ "targetCertConstraints parameter must be an "
|
||||||
+ "X509CertSelector");
|
+ "X509CertSelector");
|
||||||
}
|
}
|
||||||
if (params instanceof SunCertPathBuilderParameters) {
|
|
||||||
buildForward =
|
|
||||||
((SunCertPathBuilderParameters)params).getBuildForward();
|
|
||||||
}
|
|
||||||
this.params = params;
|
this.params = params;
|
||||||
this.targetSubject = getTargetSubject(
|
this.targetSubject = getTargetSubject(
|
||||||
certStores(), (X509CertSelector)targetCertConstraints());
|
certStores(), (X509CertSelector)targetCertConstraints());
|
||||||
@ -230,7 +224,6 @@ class PKIX {
|
|||||||
return stores;
|
return stores;
|
||||||
}
|
}
|
||||||
int maxPathLength() { return params.getMaxPathLength(); }
|
int maxPathLength() { return params.getMaxPathLength(); }
|
||||||
boolean buildForward() { return buildForward; }
|
|
||||||
PKIXBuilderParameters params() { return params; }
|
PKIXBuilderParameters params() { return params; }
|
||||||
X500Principal targetSubject() { return targetSubject; }
|
X500Principal targetSubject() { return targetSubject; }
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user