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