diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers
index 8bd1118c1ff..c34ba2f709d 100644
--- a/jdk/make/mapfiles/libjava/mapfile-vers
+++ b/jdk/make/mapfiles/libjava/mapfile-vers
@@ -56,6 +56,7 @@ SUNWprivate_1.1 {
JNU_ThrowArrayIndexOutOfBoundsException;
JNU_ThrowByName;
JNU_ThrowByNameWithLastError;
+ JNU_ThrowByNameWithMessageAndLastError;
JNU_ThrowClassNotFoundException;
JNU_ThrowIllegalAccessError;
JNU_ThrowIllegalAccessException;
diff --git a/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c b/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c
index cbbfde4c2a7..ea3dc25c624 100644
--- a/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c
+++ b/jdk/src/java.base/macosx/native/libjava/java_props_macosx.c
@@ -182,7 +182,17 @@ void setOSNameAndVersion(java_props_t *sprops) {
// Copy out the char*
osVersionCStr = strdup([nsVerStr UTF8String]);
}
-
+ // Fallback if running on pre-10.9 Mac OS
+ if (osVersionCStr == NULL) {
+ NSDictionary *version = [NSDictionary dictionaryWithContentsOfFile :
+ @"/System/Library/CoreServices/SystemVersion.plist"];
+ if (version != NULL) {
+ NSString *nsVerStr = [version objectForKey : @"ProductVersion"];
+ if (nsVerStr != NULL) {
+ osVersionCStr = strdup([nsVerStr UTF8String]);
+ }
+ }
+ }
if (osVersionCStr == NULL) {
osVersionCStr = strdup("Unknown");
}
@@ -190,7 +200,9 @@ void setOSNameAndVersion(java_props_t *sprops) {
}
-static Boolean getProxyInfoForProtocol(CFDictionaryRef inDict, CFStringRef inEnabledKey, CFStringRef inHostKey, CFStringRef inPortKey, CFStringRef *outProxyHost, int *ioProxyPort) {
+static Boolean getProxyInfoForProtocol(CFDictionaryRef inDict, CFStringRef inEnabledKey,
+ CFStringRef inHostKey, CFStringRef inPortKey,
+ CFStringRef *outProxyHost, int *ioProxyPort) {
/* See if the proxy is enabled. */
CFNumberRef cf_enabled = CFDictionaryGetValue(inDict, inEnabledKey);
if (cf_enabled == NULL) {
diff --git a/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java b/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java
index 74eba85bd16..f94a94e252f 100644
--- a/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java
+++ b/jdk/src/java.base/share/classes/java/text/DateFormatSymbols.java
@@ -221,7 +221,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
*
* The zone ID is not localized; it's one of the valid IDs of
* the {@link java.util.TimeZone TimeZone} class that are not
- * custom IDs.
+ * custom IDs.
* All other entries are localized names.
* @see java.util.TimeZone
* @serial
diff --git a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
index 8b5fb7875af..497069cd7fc 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java
@@ -93,7 +93,7 @@ import sun.security.jca.*;
* provide authenticity assurances for both confidential data and
* Additional Associated Data (AAD) that is not encrypted. (Please see
* RFC 5116 for more
- * information on AEAD and AEAD algorithms such as GCM/CCM.) Both
+ * information on AEAD and AAD algorithms such as GCM/CCM.) Both
* confidential and AAD data can be used when calculating the
* authentication tag (similar to a {@link Mac}). This tag is appended
* to the ciphertext during encryption, and is verified on decryption.
@@ -1186,7 +1186,7 @@ public class Cipher {
* determined from the given key, or if the given key has a keysize that
* exceeds the maximum allowable keysize (as determined from the
* configured jurisdiction policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1239,7 +1239,7 @@ public class Cipher {
* determined from the given key, or if the given key has a keysize that
* exceeds the maximum allowable keysize (as determined from the
* configured jurisdiction policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1325,7 +1325,7 @@ public class Cipher {
* algorithm parameters imply a cryptographic strength that would exceed
* the legal limits (as determined from the configured jurisdiction
* policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1386,7 +1386,7 @@ public class Cipher {
* algorithm parameters imply a cryptographic strength that would exceed
* the legal limits (as determined from the configured jurisdiction
* policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1468,7 +1468,7 @@ public class Cipher {
* algorithm parameters imply a cryptographic strength that would exceed
* the legal limits (as determined from the configured jurisdiction
* policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1529,7 +1529,7 @@ public class Cipher {
* algorithm parameters imply a cryptographic strength that would exceed
* the legal limits (as determined from the configured jurisdiction
* policy files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1616,7 +1616,7 @@ public class Cipher {
* in the given certificate has a keysize that exceeds the maximum
* allowable keysize (as determined by the configured jurisdiction policy
* files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
@@ -1686,7 +1686,7 @@ public class Cipher {
* in the given certificate has a keysize that exceeds the maximum
* allowable keysize (as determined by the configured jurisdiction policy
* files).
- * @throws UnsupportedOperationException if (@code opmode} is
+ * @throws UnsupportedOperationException if {@code opmode} is
* {@code WRAP_MODE} or {@code UNWRAP_MODE} but the mode is not implemented
* by the underlying {@code CipherSpi}.
*/
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java b/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java
index 0cc7cec686e..ee312952c44 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusResponseManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -97,10 +97,11 @@ final class StatusResponseManager {
t.setDaemon(true);
return t;
}
- });
+ }, new ThreadPoolExecutor.DiscardPolicy());
threadMgr.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
threadMgr.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
threadMgr.setKeepAliveTime(5000, TimeUnit.MILLISECONDS);
+ threadMgr.allowCoreThreadTimeOut(true);
responseCache = Cache.newSoftMemoryCache(cacheCapacity, cacheLifetime);
}
diff --git a/jdk/src/java.base/share/native/libjava/jni_util.c b/jdk/src/java.base/share/native/libjava/jni_util.c
index 89f6edb7c03..3ea11b0bbc6 100644
--- a/jdk/src/java.base/share/native/libjava/jni_util.c
+++ b/jdk/src/java.base/share/native/libjava/jni_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -147,9 +147,9 @@ JNU_ThrowInstantiationException(JNIEnv *env, const char *msg)
JNU_ThrowByName(env, "java/lang/InstantiationException", msg);
}
-
-/* Throw an exception by name, using the string returned by
- * JVM_LastErrorString for the detail string. If the last-error
+/*
+ * Throw an exception by name, using the string returned by
+ * getLastErrorString for the detail string. If the last-error
* string is NULL, use the given default detail string.
*/
JNIEXPORT void JNICALL
@@ -174,9 +174,64 @@ JNU_ThrowByNameWithLastError(JNIEnv *env, const char *name,
}
}
-/* Throw an IOException, using the last-error string for the detail
- * string. If the last-error string is NULL, use the given default
- * detail string.
+/*
+ * Throw an exception by name, using a given message and the string
+ * returned by getLastErrorString to construct the detail string.
+ */
+JNIEXPORT void JNICALL
+JNU_ThrowByNameWithMessageAndLastError
+ (JNIEnv *env, const char *name, const char *message)
+{
+ char buf[256];
+ size_t n = getLastErrorString(buf, sizeof(buf));
+ size_t messagelen = message == NULL ? 0 : strlen(message);
+
+ if (n > 0) {
+ jstring s = JNU_NewStringPlatform(env, buf);
+ if (s != NULL) {
+ jobject x = NULL;
+ if (messagelen) {
+ jstring s2 = NULL;
+ size_t messageextlen = messagelen + 4;
+ char *str1 = (char *)malloc((messageextlen) * sizeof(char));
+ if (str1 == 0) {
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return;
+ }
+ jio_snprintf(str1, messageextlen, " (%s)", message);
+ s2 = (*env)->NewStringUTF(env, str1);
+ free(str1);
+ if (s2 != NULL) {
+ jstring s3 = JNU_CallMethodByName(
+ env, NULL, s, "concat",
+ "(Ljava/lang/String;)Ljava/lang/String;",
+ s2).l;
+ (*env)->DeleteLocalRef(env, s2);
+ if (s3 != NULL) {
+ (*env)->DeleteLocalRef(env, s);
+ s = s3;
+ }
+ }
+ }
+ x = JNU_NewObjectByName(env, name, "(Ljava/lang/String;)V", s);
+ if (x != NULL) {
+ (*env)->Throw(env, x);
+ }
+ }
+ }
+
+ if (!(*env)->ExceptionOccurred(env)) {
+ if (messagelen) {
+ JNU_ThrowByName(env, name, message);
+ } else {
+ JNU_ThrowByName(env, name, "no further information");
+ }
+ }
+}
+
+/*
+ * Convenience method.
+ * Call JNU_ThrowByNameWithLastError for java.io.IOException.
*/
JNIEXPORT void JNICALL
JNU_ThrowIOExceptionWithLastError(JNIEnv *env, const char *defaultDetail)
diff --git a/jdk/src/java.base/share/native/libjava/jni_util.h b/jdk/src/java.base/share/native/libjava/jni_util.h
index 96796571dc7..960a225efbb 100644
--- a/jdk/src/java.base/share/native/libjava/jni_util.h
+++ b/jdk/src/java.base/share/native/libjava/jni_util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -98,15 +98,22 @@ JNIEXPORT void JNICALL
JNU_ThrowInstantiationException(JNIEnv *env, const char *msg);
/* Throw an exception by name, using the string returned by
- * JVM_LastErrorString for the detail string. If the last-error
+ * getLastErrorString for the detail string. If the last-error
* string is NULL, use the given default detail string.
*/
JNIEXPORT void JNICALL
JNU_ThrowByNameWithLastError(JNIEnv *env, const char *name,
- const char *defaultMessage);
+ const char *defaultDetail);
+
+/* Throw an exception by name, using a given message and the string
+ * returned by getLastErrorString to construct the detail string.
+ */
+JNIEXPORT void JNICALL
+JNU_ThrowByNameWithMessageAndLastError
+ (JNIEnv *env, const char *name, const char *message);
/* Throw an IOException, using the last-error string for the detail
- * string. If the last-error string is NULL, use the given default
+ * string. If the last-error string is NULL, use the given default
* detail string.
*/
JNIEXPORT void JNICALL
diff --git a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
index 863aa591059..e93824f8d04 100644
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c
@@ -621,8 +621,8 @@ static int getFlags0(JNIEnv *env, jstring name) {
(*env)->ReleaseStringUTFChars(env, name, name_utf);
if (ret < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFFLAGS failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "getFlags() failed");
return -1;
}
@@ -1061,8 +1061,8 @@ static int openSocket(JNIEnv *env, int proto) {
// If EPROTONOSUPPORT is returned it means we don't have
// support for this proto so don't throw an exception.
if (errno != EPROTONOSUPPORT) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Socket creation failed");
}
return -1;
}
@@ -1087,13 +1087,13 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
if (errno == EPROTONOSUPPORT) {
if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV6 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
return -1;
}
} else { // errno is not NOSUPPORT
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV4 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV4 Socket creation failed");
return -1;
}
}
@@ -1122,15 +1122,15 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
// SIOCGIFCOUNT doesn't work
ifc.ifc_buf = NULL;
if (ioctl(sock, SIOCGIFCONF, (char *)&ifc) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFCONF) failed");
return ifs;
}
#elif defined(_AIX)
ifc.ifc_buf = NULL;
if (ioctl(sock, SIOCGSIZIFCONF, &(ifc.ifc_len)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGSIZIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGSIZIFCONF) failed");
return ifs;
}
#endif /* __linux__ */
@@ -1142,8 +1142,8 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
siocgifconfRequest = CSIOCGIFCONF;
#endif
if (ioctl(sock, siocgifconfRequest, (char *)&ifc) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFCONF) failed");
free(buf);
return ifs;
}
@@ -1268,8 +1268,8 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
ifc.ifc_buf = NULL;
if (ioctl(sock, SIOCGSIZIFCONF, &(ifc.ifc_len)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGSIZIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGSIZIFCONF) failed");
return ifs;
}
bufsize = ifc.ifc_len;
@@ -1282,8 +1282,8 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
ifc.ifc_len = bufsize;
ifc.ifc_buf = buf;
if (ioctl(sock, SIOCGIFCONF, (char *)&ifc) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl CSIOCGIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFCONF) failed");
free(buf);
return ifs;
}
@@ -1368,16 +1368,16 @@ static struct sockaddr *getBroadcast
// Let's make sure the interface does have a broadcast address.
if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFFLAGS failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFFLAGS) failed");
return ret;
}
if (if2.ifr_flags & IFF_BROADCAST) {
// It does, let's retrieve it
if (ioctl(sock, SIOCGIFBRDADDR, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFBRDADDR failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFBRDADDR) failed");
return ret;
}
@@ -1400,8 +1400,8 @@ static short getSubnet(JNIEnv *env, int sock, const char *ifname) {
strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
if (ioctl(sock, SIOCGIFNETMASK, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFNETMASK failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFNETMASK) failed");
return -1;
}
@@ -1463,8 +1463,8 @@ static int getMacAddress
memset((char *)&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1);
if (ioctl(sock, SIOCGIFHWADDR, &ifr) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFHWADDR failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFHWADDR) failed");
return -1;
}
@@ -1493,8 +1493,8 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) {
}
if (ioctl(sock, SIOCGIFMTU, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFMTU failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFMTU) failed");
return -1;
}
@@ -1535,15 +1535,15 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
if (errno == EPROTONOSUPPORT) {
if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV6 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
return -1;
}
alreadyV6=1;
} else { // errno is not NOSUPPORT
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV4 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV4 Socket creation failed");
return -1;
}
}
@@ -1562,8 +1562,8 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
if (ioctl(sock, SIOCGLIFNETMASK, (char *)&if2) < 0) {
close(sock);
if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV6 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
return -1;
}
}
@@ -1607,8 +1607,8 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family)
numifs.lifn_family = family;
numifs.lifn_flags = 0;
if (ioctl(sock, SIOCGLIFNUM, (char *)&numifs) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFNUM failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNUM) failed");
return ifs;
}
@@ -1621,8 +1621,8 @@ static netif *enumIPvXInterfaces(JNIEnv *env, int sock, netif *ifs, int family)
ifc.lifc_len = bufsize;
ifc.lifc_buf = buf;
if (ioctl(sock, SIOCGLIFCONF, (char *)&ifc) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFCONF failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFCONF) failed");
free(buf);
return ifs;
}
@@ -1689,16 +1689,16 @@ static struct sockaddr *getBroadcast
// Let's make sure the interface does have a broadcast address
if (ioctl(sock, SIOCGLIFFLAGS, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFFLAGS failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFFLAGS) failed");
return ret;
}
if (if2.lifr_flags & IFF_BROADCAST) {
// It does, let's retrieve it
if (ioctl(sock, SIOCGLIFBRDADDR, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFBRDADDR failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFBRDADDR) failed");
return ret;
}
@@ -1721,8 +1721,8 @@ static short getSubnet(JNIEnv *env, int sock, const char *ifname) {
strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
if (ioctl(sock, SIOCGLIFNETMASK, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFNETMASK failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFNETMASK) failed");
return -1;
}
@@ -1764,8 +1764,8 @@ static int getMacFromDevice
msg.len = DL_PHYS_ADDR_REQ_SIZE;
if (putmsg(fd, &msg, NULL, 0) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "putmsg failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "putmsg() failed");
return -1;
}
@@ -1775,8 +1775,8 @@ static int getMacFromDevice
msg.len = 0;
msg.maxlen = sizeof (buf);
if (getmsg(fd, &msg, NULL, &flags) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "getmsg failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "getmsg() failed");
return -1;
}
@@ -1860,8 +1860,8 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) {
strncpy(if2.lifr_name, ifname, sizeof(if2.lifr_name) - 1);
if (ioctl(sock, SIOCGLIFMTU, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGLIFMTU failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGLIFMTU) failed");
return -1;
}
@@ -1900,13 +1900,13 @@ static int openSocketWithFallback(JNIEnv *env, const char *ifname) {
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
if (errno == EPROTONOSUPPORT) {
if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV6 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV6 Socket creation failed");
return -1;
}
} else { // errno is not NOSUPPORT
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "IPV4 Socket creation failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "IPV4 Socket creation failed");
return -1;
}
}
@@ -1927,8 +1927,8 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
struct ifaddrs *ifa, *origifa;
if (getifaddrs(&origifa) != 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "getifaddrs() function failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "getifaddrs() failed");
return ifs;
}
@@ -1997,8 +1997,8 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
struct in6_ifreq ifr6;
if (getifaddrs(&origifa) != 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "getifaddrs() function failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "getifaddrs() failed");
return ifs;
}
@@ -2014,8 +2014,8 @@ static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
MIN(sizeof(ifr6.ifr_addr), ifa->ifa_addr->sa_len));
if (ioctl(sock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFNETMASK_IN6 failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFNETMASK_IN6) failed");
freeifaddrs(origifa);
freeif(ifs);
return NULL;
@@ -2075,16 +2075,16 @@ static struct sockaddr *getBroadcast
// Make sure the interface does have a broadcast address
if (ioctl(sock, SIOCGIFFLAGS, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFFLAGS failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFFLAGS) failed");
return ret;
}
if (if2.ifr_flags & IFF_BROADCAST) {
// It does, let's retrieve it
if (ioctl(sock, SIOCGIFBRDADDR, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFBRDADDR failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFBRDADDR) failed");
return ret;
}
@@ -2107,8 +2107,8 @@ static short getSubnet(JNIEnv *env, int sock, const char *ifname) {
strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
if (ioctl(sock, SIOCGIFNETMASK, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFNETMASK failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFNETMASK) failed");
return -1;
}
@@ -2156,8 +2156,8 @@ static int getMTU(JNIEnv *env, int sock, const char *ifname) {
strncpy(if2.ifr_name, ifname, sizeof(if2.ifr_name) - 1);
if (ioctl(sock, SIOCGIFMTU, (char *)&if2) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl SIOCGIFMTU failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl(SIOCGIFMTU) failed");
return -1;
}
diff --git a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
index 034040baf83..f141ad234c4 100644
--- a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c
@@ -221,8 +221,8 @@ Java_java_net_PlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
"Bind failed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Bind failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Bind failed");
}
return;
}
@@ -233,8 +233,8 @@ Java_java_net_PlainDatagramSocketImpl_bind0(JNIEnv *env, jobject this,
* that the system chose for us and store it in the Socket object.
*/
if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return;
}
@@ -469,7 +469,7 @@ Java_java_net_PlainDatagramSocketImpl_send(JNIEnv *env, jobject this,
JNU_ThrowByName(env, JNU_JAVANETPKG "PortUnreachableException",
"ICMP Port Unreachable");
} else {
- NET_ThrowByNameWithLastError(env, "java/io/IOException", "sendto failed");
+ JNU_ThrowIOExceptionWithLastError(env, "sendto failed");
}
}
@@ -520,7 +520,8 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
} else if (errno == ENOMEM) {
JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Peek failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Peek failed");
}
return ret;
}
@@ -544,7 +545,8 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Peek failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Peek failed");
}
}
return 0;
@@ -616,7 +618,8 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
} else if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Receive failed");
#else
} else {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
@@ -681,7 +684,8 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Receive failed");
}
}
} else {
@@ -827,7 +831,8 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
} else if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Receive failed");
#else
} else {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
@@ -859,7 +864,8 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Receive failed");
}
}
} else {
@@ -932,8 +938,8 @@ Java_java_net_PlainDatagramSocketImpl_datagramSocketCreate(JNIEnv *env,
}
if ((fd = socket(domain, SOCK_DGRAM, 0)) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error creating socket");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error creating socket");
return;
}
@@ -1080,8 +1086,8 @@ static void mcast_set_if_by_if_v4(JNIEnv *env, jobject this, int fd, jobject val
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(const char*)&in, sizeof(in)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
@@ -1109,8 +1115,8 @@ static void mcast_set_if_by_if_v6(JNIEnv *env, jobject this, int fd, jobject val
"IPV6_MULTICAST_IF failed (interface has IPv4 "
"address only?)");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
return;
}
@@ -1129,8 +1135,8 @@ static void mcast_set_if_by_addr_v4(JNIEnv *env, jobject this, int fd, jobject v
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(const char*)&in, sizeof(in)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
@@ -1256,8 +1262,10 @@ static void mcast_set_loop_v4(JNIEnv *env, jobject this, int fd, jobject value)
on = (*env)->GetBooleanField(env, value, fid);
loopback = (!on ? 1 : 0);
- if (NET_SetSockOpt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, (const void *)&loopback, sizeof(char)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
+ if (NET_SetSockOpt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
+ (const void *)&loopback, sizeof(char)) < 0) {
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
return;
}
}
@@ -1280,8 +1288,10 @@ static void mcast_set_loop_v6(JNIEnv *env, jobject this, int fd, jobject value)
on = (*env)->GetBooleanField(env, value, fid);
loopback = (!on ? 1 : 0);
- if (NET_SetSockOpt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, (const void *)&loopback, sizeof(int)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
+ if (NET_SetSockOpt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
+ (const void *)&loopback, sizeof(int)) < 0) {
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
return;
}
@@ -1420,7 +1430,8 @@ Java_java_net_PlainDatagramSocketImpl_socketSetOption0(JNIEnv *env,
}
if (NET_SetSockOpt(fd, level, optname, (const void *)&optval, optlen) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
return;
}
}
@@ -1483,8 +1494,8 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(char *)inP, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return NULL;
}
@@ -1581,8 +1592,8 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
if (getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
(char*)&index, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return NULL;
}
@@ -1726,8 +1737,8 @@ Java_java_net_PlainDatagramSocketImpl_socketGetOption(JNIEnv *env, jobject this,
len = SOCKADDR_LEN;
if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return NULL;
}
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
@@ -1752,8 +1763,8 @@ Java_java_net_PlainDatagramSocketImpl_socketGetOption(JNIEnv *env, jobject this,
}
if (NET_GetSockOpt(fd, level, optname, (void *)&optval, &optlen) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return NULL;
}
@@ -1805,8 +1816,8 @@ static void setTTL(JNIEnv *env, int fd, jint ttl) {
char ittl = (char)ttl;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, (char*)&ittl,
sizeof(ittl)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
@@ -1818,8 +1829,8 @@ static void setHopLimit(JNIEnv *env, int fd, jint ttl) {
int ittl = (int)ttl;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
(char*)&ittl, sizeof(ittl)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
#endif
@@ -1901,8 +1912,8 @@ Java_java_net_PlainDatagramSocketImpl_getTimeToLive(JNIEnv *env, jobject this) {
if (getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
(char*)&ttl, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return -1;
}
return (jint)ttl;
@@ -1913,8 +1924,8 @@ Java_java_net_PlainDatagramSocketImpl_getTimeToLive(JNIEnv *env, jobject this) {
socklen_t len = sizeof(ttl);
if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
(char*)&ttl, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return -1;
}
return (jint)ttl;
diff --git a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
index 01d763a2c2d..ba8e483c101 100644
--- a/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
+++ b/jdk/src/java.base/unix/native/libnet/PlainSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -476,7 +476,8 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
"Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "connect failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "connect failed");
}
return;
}
@@ -498,8 +499,8 @@ Java_java_net_PlainSocketImpl_socketConnect(JNIEnv *env, jobject this,
*/
socklen_t slen = SOCKADDR_LEN;
if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
} else {
localport = NET_GetPortFromSockaddr((struct sockaddr *)&him);
(*env)->SetIntField(env, this, psi_localportID, localport);
@@ -536,8 +537,9 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
}
/* bind */
- if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him, &len, JNI_TRUE) != 0) {
- return;
+ if (NET_InetAddressToSockaddr(env, iaObj, localport, (struct sockaddr *)&him,
+ &len, JNI_TRUE) != 0) {
+ return;
}
setDefaultScopeID(env, (struct sockaddr *)&him);
@@ -547,8 +549,8 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "BindException",
"Bind failed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Bind failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Bind failed");
}
return;
}
@@ -563,8 +565,8 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
* that the system chose for us and store it in the Socket object.
*/
if (getsockname(fd, (struct sockaddr *)&him, &slen) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return;
}
localport = NET_GetPortFromSockaddr((struct sockaddr *)&him);
@@ -580,8 +582,8 @@ Java_java_net_PlainSocketImpl_socketBind(JNIEnv *env, jobject this,
* Signature: (I)V
*/
JNIEXPORT void JNICALL
-Java_java_net_PlainSocketImpl_socketListen (JNIEnv *env, jobject this,
- jint count)
+Java_java_net_PlainSocketImpl_socketListen(JNIEnv *env, jobject this,
+ jint count)
{
/* this FileDescriptor fd field */
jobject fdObj = (*env)->GetObjectField(env, this, psi_fdID);
@@ -604,8 +606,8 @@ Java_java_net_PlainSocketImpl_socketListen (JNIEnv *env, jobject this,
count -= 1;
if (listen(fd, count) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Listen failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Listen failed");
}
}
@@ -684,7 +686,8 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
} else if (errno == ENOMEM) {
JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Accept failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Accept failed");
}
return;
}
@@ -727,7 +730,8 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Accept failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Accept failed");
}
}
return;
@@ -781,8 +785,8 @@ Java_java_net_PlainSocketImpl_socketAvailable(JNIEnv *env, jobject this) {
if (errno == ECONNRESET) {
JNU_ThrowByName(env, "sun/net/ConnectionResetException", "");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "ioctl FIONREAD failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "ioctl FIONREAD failed");
}
}
return ret;
@@ -936,8 +940,8 @@ Java_java_net_PlainSocketImpl_socketSetOption0(JNIEnv *env, jobject this,
return;
}
#endif /* __solaris__ */
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
}
@@ -981,8 +985,8 @@ Java_java_net_PlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
len = SOCKADDR_LEN;
if (getsockname(fd, (struct sockaddr *)&him, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return -1;
}
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
@@ -1014,8 +1018,8 @@ Java_java_net_PlainSocketImpl_socketGetOption(JNIEnv *env, jobject this,
}
if (NET_GetSockOpt(fd, level, optname, (void *)&optval, &optlen) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return -1;
}
@@ -1063,6 +1067,6 @@ Java_java_net_PlainSocketImpl_socketSendUrgentData(JNIEnv *env, jobject this,
}
n = NET_Send(fd, (char *)&d, 1, MSG_OOB);
if (n == -1) {
- NET_ThrowByNameWithLastError(env, "java/io/IOException", "Write failed");
+ JNU_ThrowIOExceptionWithLastError(env, "Write failed");
}
}
diff --git a/jdk/src/java.base/unix/native/libnet/SocketInputStream.c b/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
index 9857d18573b..08d8508b154 100644
--- a/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
+++ b/jdk/src/java.base/unix/native/libnet/SocketInputStream.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
} else if (errno == ENOMEM) {
JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "select/poll failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "select/poll failed");
}
}
if (bufP != BUF) {
@@ -145,8 +145,8 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
break;
default:
- NET_ThrowByNameWithLastError(env,
- JNU_JAVANETPKG "SocketException", "Read failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Read failed");
}
}
} else {
diff --git a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
index 5d40bd83df3..f5a685a741c 100644
--- a/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
+++ b/jdk/src/java.base/unix/native/libnet/SocketOutputStream.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -114,8 +114,8 @@ Java_java_net_SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
JNU_ThrowByName(env, "sun/net/ConnectionResetException",
"Connection reset");
} else {
- NET_ThrowByNameWithLastError(env, "java/net/SocketException",
- "Write failed");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, "java/net/SocketException", "Write failed");
}
if (bufP != BUF) {
free(bufP);
diff --git a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c
index 3db3d7b2fc2..b37adf7e1d4 100644
--- a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c
+++ b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainDatagramSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1713,8 +1713,8 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1,
in.s_addr = htonl(getInetAddress_addr(env, value));
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(const char*)&in, sizeof(in)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
return;
}
@@ -1741,7 +1741,7 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1,
}
index = (*env)->GetIntField(env, value, ni_indexID);
- if ( isAdapterIpv6Enabled(env, index) != 0 ) {
+ if (isAdapterIpv6Enabled(env, index) != 0) {
if (setsockopt(fd1, IPPROTO_IPV6, IPV6_MULTICAST_IF,
(const char*)&index, sizeof(index)) < 0) {
if (errno == EINVAL && index > 0) {
@@ -1749,8 +1749,8 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1,
"IPV6_MULTICAST_IF failed (interface has IPv4 "
"address only?)");
} else {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
return;
}
@@ -1758,13 +1758,13 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1,
/* If there are any IPv4 addresses on this interface then
* repeat the operation on the IPv4 fd */
- if (getInet4AddrFromIf (env, value, &in) < 0) {
+ if (getInet4AddrFromIf(env, value, &in) < 0) {
return;
}
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(const char*)&in, sizeof(in)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
return;
} else {
@@ -1781,8 +1781,8 @@ static void setMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1,
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(const char*)&in, sizeof(in)) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error setting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error setting socket option");
}
return;
}
@@ -1932,8 +1932,8 @@ static jobject getIPv4NetworkInterface (JNIEnv *env, jobject this, int fd, jint
int len = sizeof(struct in_addr);
if (getsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF,
(char *)inP, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return NULL;
}
@@ -2056,8 +2056,8 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
{
if (getsockopt(fd1, IPPROTO_IPV6, IPV6_MULTICAST_IF,
(char*)&index, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket option");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket option");
return NULL;
}
}
@@ -2288,8 +2288,8 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_socketLocalAddress(JNIEnv *env, j
}
if (getsockname(fd, (struct sockaddr *)&him, &len) == -1) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return NULL;
}
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
diff --git a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c
index b4f9f140789..3d950d3d4ad 100644
--- a/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c
+++ b/jdk/src/java.base/windows/native/libnet/TwoStacksPlainSocketImpl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1054,8 +1054,8 @@ Java_java_net_TwoStacksPlainSocketImpl_socketGetOption(JNIEnv *env, jobject this
}
if (getsockname(fd, (struct sockaddr *)&him, &len) < 0) {
- NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
- "Error getting socket name");
+ JNU_ThrowByNameWithMessageAndLastError
+ (env, JNU_JAVANETPKG "SocketException", "Error getting socket name");
return -1;
}
iaObj = NET_SockaddrToInetAddress(env, (struct sockaddr *)&him, &port);
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java
index e899d378963..1a23e19fa2b 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java
@@ -32,10 +32,10 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.internal.JlinkTask;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.internal.PluginRepository;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
index 2c0620a99db..804b1da794e 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java
@@ -57,7 +57,7 @@ import java.util.Set;
import jdk.tools.jlink.internal.BasicImageWriter;
import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java
index 10cea85d363..18339b9682f 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java
@@ -27,7 +27,7 @@ package jdk.tools.jlink.builder;
import java.io.DataOutputStream;
import java.util.Properties;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ExecutableImage.java
similarity index 98%
rename from jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java
rename to jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ExecutableImage.java
index 499d23dd450..1e788e0ce1d 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ExecutableImage.java
@@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.tools.jlink.plugin;
+package jdk.tools.jlink.internal;
import java.nio.file.Path;
import java.util.List;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java
index d492c09f1d5..339b4d3d558 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java
@@ -43,7 +43,6 @@ import java.util.stream.Stream;
import jdk.tools.jlink.internal.Archive.Entry;
import jdk.tools.jlink.internal.Archive.Entry.EntryType;
import jdk.tools.jlink.internal.ModulePoolImpl.CompressedModuleData;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java
index a5bd7bf41f8..37064ec13d8 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java
@@ -32,15 +32,12 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.Jlink;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
/**
* Plugins configuration.
@@ -85,7 +82,7 @@ public final class ImagePluginConfiguration {
+ " added more than once to stack ");
}
seen.add(plug.getName());
- Category category = Utils.getCategory(plug);
+ Category category = plug.getType();
if (category == null) {
throw new PluginException("Invalid category for "
+ plug.getName());
@@ -94,26 +91,13 @@ public final class ImagePluginConfiguration {
lst.add(plug);
}
- List transformerPlugins = new ArrayList<>();
- List postProcessingPlugins = new ArrayList<>();
+ List orderedPlugins = new ArrayList<>();
plugins.entrySet().stream().forEach((entry) -> {
// Sort according to plugin constraints
- List orderedPlugins = PluginOrderingGraph.sort(entry.getValue());
- Category category = entry.getKey();
- orderedPlugins.stream().forEach((p) -> {
- if (category.isPostProcessor()) {
- @SuppressWarnings("unchecked")
- PostProcessorPlugin pp = (PostProcessorPlugin) p;
- postProcessingPlugins.add(pp);
- } else {
- @SuppressWarnings("unchecked")
- TransformerPlugin trans = (TransformerPlugin) p;
- transformerPlugins.add(trans);
- }
- });
+ orderedPlugins.addAll(PluginOrderingGraph.sort(entry.getValue()));
});
Plugin lastSorter = null;
- for (Plugin plugin : transformerPlugins) {
+ for (Plugin plugin : orderedPlugins) {
if (plugin.getName().equals(pluginsConfiguration.getLastSorterPluginName())) {
lastSorter = plugin;
break;
@@ -145,7 +129,6 @@ public final class ImagePluginConfiguration {
};
}
- return new ImagePluginStack(builder, transformerPlugins,
- lastSorter, postProcessingPlugins);
+ return new ImagePluginStack(builder, orderedPlugins, lastSorter);
}
}
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
index 7d3dd182739..b8f44d84906 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java
@@ -44,14 +44,11 @@ import java.util.stream.Stream;
import jdk.internal.jimage.decompressor.Decompressor;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.LinkModule;
import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
/**
* Plugins Stack. Plugins entry point to apply transformations onto resources
@@ -161,42 +158,34 @@ public final class ImagePluginStack {
private final ImageBuilder imageBuilder;
private final Plugin lastSorter;
- private final List contentPlugins = new ArrayList<>();
- private final List postProcessingPlugins = new ArrayList<>();
+ private final List plugins = new ArrayList<>();
private final List resourcePrevisitors = new ArrayList<>();
public ImagePluginStack() {
- this(null, Collections.emptyList(), null,
- Collections.emptyList());
+ this(null, Collections.emptyList(), null);
}
public ImagePluginStack(ImageBuilder imageBuilder,
- List contentPlugins,
- Plugin lastSorter,
- List postprocessingPlugins) {
+ List plugins,
+ Plugin lastSorter) {
this.imageBuilder = Objects.requireNonNull(imageBuilder);
this.lastSorter = lastSorter;
- Objects.requireNonNull(contentPlugins);
- Objects.requireNonNull(postprocessingPlugins);
- contentPlugins.stream().forEach((p) -> {
+ this.plugins.addAll(Objects.requireNonNull(plugins));
+ plugins.stream().forEach((p) -> {
Objects.requireNonNull(p);
if (p instanceof ResourcePrevisitor) {
resourcePrevisitors.add((ResourcePrevisitor) p);
}
- this.contentPlugins.add(p);
- });
- postprocessingPlugins.stream().forEach((p) -> {
- Objects.requireNonNull(p);
- this.postProcessingPlugins.add(p);
});
}
public void operate(ImageProvider provider) throws Exception {
ExecutableImage img = provider.retrieve(this);
List arguments = new ArrayList<>();
- postProcessingPlugins.stream()
- .map((plugin) -> plugin.process(img))
+ plugins.stream()
+ .filter(PostProcessor.class::isInstance)
+ .map((plugin) -> ((PostProcessor)plugin).process(img))
.filter((lst) -> (lst != null))
.forEach((lst) -> {
arguments.addAll(lst);
@@ -241,7 +230,7 @@ public final class ImagePluginStack {
ModulePoolImpl current = resources;
List frozenOrder = null;
- for (TransformerPlugin p : contentPlugins) {
+ for (Plugin p : plugins) {
current.setReadOnly();
ModulePoolImpl output = null;
if (p == lastSorter) {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
index c6732081cf1..396fb315101 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
@@ -49,7 +49,6 @@ import static jdk.tools.jlink.internal.TaskHelper.JLINK_BUNDLE;
import jdk.tools.jlink.internal.TaskHelper.Option;
import jdk.tools.jlink.internal.TaskHelper.OptionsHelper;
import jdk.tools.jlink.internal.ImagePluginStack.ImageProvider;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.Jlink.JlinkConfiguration;
import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.plugin.PluginException;
@@ -184,8 +183,8 @@ public class JlinkTask {
optionsHelper.showHelp(PROGNAME);
return EXIT_OK;
}
- if (optionsHelper.listPlugins()) {
- optionsHelper.listPlugins(true);
+ if (optionsHelper.shouldListPlugins()) {
+ optionsHelper.listPlugins();
return EXIT_OK;
}
if (options.version || options.fullVersion) {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java
index e4dd7b3bd1c..6a7af972a83 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java
@@ -34,8 +34,6 @@ import java.util.Objects;
import java.util.ServiceLoader;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
/**
*
@@ -59,17 +57,7 @@ public final class PluginRepository {
*/
public static Plugin getPlugin(String name,
Layer pluginsLayer) {
- Plugin tp = getPlugin(TransformerPlugin.class, name, pluginsLayer);
- Plugin ppp = getPlugin(PostProcessorPlugin.class, name, pluginsLayer);
-
- // We should not have a transformer plugin and a post processor plugin
- // of the same name. That kind of duplicate is detected here.
- if (tp != null && ppp != null) {
- throw new PluginException("Multiple plugin "
- + "for the name " + name);
- }
-
- return tp != null? tp : ppp;
+ return getPlugin(Plugin.class, name, pluginsLayer);
}
/**
@@ -112,10 +100,7 @@ public final class PluginRepository {
}
public static List getPlugins(Layer pluginsLayer) {
- List plugins = new ArrayList<>();
- plugins.addAll(getPlugins(TransformerPlugin.class, pluginsLayer));
- plugins.addAll(getPlugins(PostProcessorPlugin.class, pluginsLayer));
- return plugins;
+ return getPlugins(Plugin.class, pluginsLayer);
}
private static T getPlugin(Class clazz, String name,
@@ -138,10 +123,10 @@ public final class PluginRepository {
}
/**
- * The post processors accessible in the current context.
+ * The plugins accessible in the current context.
*
* @param pluginsLayer
- * @return The list of post processors.
+ * @return The list of plugins.
*/
private static List getPlugins(Class clazz, Layer pluginsLayer) {
Objects.requireNonNull(pluginsLayer);
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PostProcessorPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PostProcessor.java
similarity index 86%
rename from jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PostProcessorPlugin.java
rename to jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PostProcessor.java
index 7483a5e76f6..7eda42eb384 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PostProcessorPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PostProcessor.java
@@ -22,15 +22,15 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.tools.jlink.plugin;
+package jdk.tools.jlink.internal;
import java.util.List;
/**
- * Implement this interface to develop a PostProcessor plugin.
- * PostProcessor plugins are called once the image has been generated and is executable.
+ * Plugin wishing to post-proces must implement this interface. PostProcessors
+ * are called once the image has been generated and is executable.
**/
-public interface PostProcessorPlugin extends Plugin {
+public interface PostProcessor {
/**
* Post process an image.
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
index eed739da19b..01c15f5ec2e 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
@@ -428,7 +428,7 @@ public final class TaskHelper {
return opt.hasArg;
}
- public boolean listPlugins() {
+ public boolean shouldListPlugins() {
return pluginOptions.listPlugins;
}
@@ -570,26 +570,19 @@ public final class TaskHelper {
log.println(bundleHelper.getMessage("main.command.files"));
}
- public void listPlugins(boolean showsImageBuilder) {
+ public void listPlugins() {
log.println("\n" + bundleHelper.getMessage("main.extended.help"));
List pluginList = PluginRepository.
getPlugins(pluginOptions.pluginsLayer);
- for (Plugin plugin : Utils.
- getSortedPreProcessors(pluginList)) {
- showPlugin(plugin, log, showsImageBuilder);
- }
-
- if (showsImageBuilder) {
- for (Plugin plugin : Utils.getSortedPostProcessors(pluginList)) {
- showPlugin(plugin, log, showsImageBuilder);
- }
+ for (Plugin plugin : Utils.getSortedPlugins(pluginList)) {
+ showPlugin(plugin, log);
}
log.println("\n" + bundleHelper.getMessage("main.extended.help.footer"));
}
- private void showPlugin(Plugin plugin, PrintWriter log, boolean showsImageBuilder) {
- if (showsPlugin(plugin, showsImageBuilder)) {
+ private void showPlugin(Plugin plugin, PrintWriter log) {
+ if (showsPlugin(plugin)) {
log.println("\n" + bundleHelper.getMessage("main.plugin.name")
+ ": " + plugin.getName());
@@ -599,7 +592,7 @@ public final class TaskHelper {
+ ": " + plugin.getClass().getName());
log.println(bundleHelper.getMessage("main.plugin.module")
+ ": " + plugin.getClass().getModule().getName());
- Category category = Utils.getCategory(plugin);
+ Category category = plugin.getType();
log.println(bundleHelper.getMessage("main.plugin.category")
+ ": " + category.getName());
log.println(bundleHelper.getMessage("main.plugin.state")
@@ -722,14 +715,8 @@ public final class TaskHelper {
}
}
- // Display all plugins or pre processors only.
- private static boolean showsPlugin(Plugin plugin, boolean showsImageBuilder) {
- if (!Utils.isDisabled(plugin) && plugin.getOption() != null) {
- if (Utils.isPostProcessor(plugin) && !showsImageBuilder) {
- return false;
- }
- return true;
- }
- return false;
+ // Display all plugins
+ private static boolean showsPlugin(Plugin plugin) {
+ return (!Utils.isDisabled(plugin) && plugin.getOption() != null);
}
}
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java
index 7a166e1c82c..ef8fb392086 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,51 +55,10 @@ public class Utils {
.collect(Collectors.toList());
}
- public static boolean isPostProcessor(Plugin provider) {
- return provider.getType().isPostProcessor();
- }
- public static boolean isPreProcessor(Plugin provider) {
- return !isPostProcessor(provider);
- }
-
- public static Category getCategory(Plugin provider) {
- return provider.getType();
- }
-
- public static List getPreProcessors(List plugins) {
+ public static List getSortedPlugins(List plugins) {
List res = new ArrayList<>();
- for (Plugin p : plugins) {
- if (isPreProcessor(p)) {
- res.add(p);
- }
- }
- return res;
- }
-
- public static List getPostProcessors(List plugins) {
- List res = new ArrayList<>();
- for (Plugin p : plugins) {
- if (isPostProcessor(p)) {
- res.add(p);
- }
- }
- return res;
- }
-
- public static List getSortedPostProcessors(List plugins) {
- List res = getPostProcessors(plugins);
- res.sort(new Comparator() {
- @Override
- public int compare(Plugin o1, Plugin o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- return res;
- }
-
- public static List getSortedPreProcessors(List plugins) {
- List res = getPreProcessors(plugins);
+ res.addAll(plugins);
res.sort(new Comparator() {
@Override
public int compare(Plugin o1, Plugin o2) {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java
index bc753cfb8cd..75fb2f12c9e 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java
@@ -28,7 +28,7 @@ import java.util.Map;
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.ImagePluginStack;
import jdk.tools.jlink.internal.ResourcePrevisitor;
import jdk.tools.jlink.internal.StringTable;
@@ -37,7 +37,7 @@ import jdk.tools.jlink.internal.StringTable;
*
* ZIP and String Sharing compression plugin
*/
-public final class DefaultCompressPlugin implements TransformerPlugin, ResourcePrevisitor {
+public final class DefaultCompressPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "compress";
public static final String FILTER = "filter";
public static final String LEVEL_0 = "0";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java
index b243ce684ef..fb7826cd6ce 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java
@@ -26,7 +26,7 @@ package jdk.tools.jlink.internal.plugins;
import java.util.Map;
import java.util.function.Predicate;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
@@ -34,7 +34,7 @@ import jdk.tools.jlink.plugin.ModuleEntry;
*
* Exclude files plugin
*/
-public final class ExcludeFilesPlugin implements TransformerPlugin {
+public final class ExcludeFilesPlugin implements Plugin {
public static final String NAME = "exclude-files";
private Predicate predicate;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java
index d193473197e..f244d6d8252 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java
@@ -26,7 +26,7 @@ package jdk.tools.jlink.internal.plugins;
import java.util.Map;
import java.util.function.Predicate;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -34,7 +34,7 @@ import jdk.tools.jlink.plugin.ModulePool;
*
* Exclude resources plugin
*/
-public final class ExcludePlugin implements TransformerPlugin {
+public final class ExcludePlugin implements Plugin {
public static final String NAME = "exclude-resources";
private Predicate predicate;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
index 8553e1a4026..278106d9236 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java
@@ -35,7 +35,7 @@ import java.util.Map;
import java.util.TreeSet;
import java.util.function.Predicate;
import java.util.stream.Collectors;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
@@ -44,7 +44,7 @@ import jdk.tools.jlink.plugin.PluginException;
*
* Exclude VM plugin
*/
-public final class ExcludeVMPlugin implements TransformerPlugin {
+public final class ExcludeVMPlugin implements Plugin {
private static final class JvmComparator implements Comparator {
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
index 195b596bf72..51db055cad9 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java
@@ -41,14 +41,14 @@ import jdk.tools.jlink.internal.PathModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.Utils;
/**
*
* Copy files to image from various locations.
*/
-public class FileCopierPlugin implements TransformerPlugin {
+public class FileCopierPlugin implements Plugin {
public static final String NAME = "copy-files";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
index b9a60ad564a..40eb349748d 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java
@@ -34,12 +34,12 @@ import java.util.stream.Collectors;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Plugin to generate java.lang.invoke classes.
*/
-public final class GenerateJLIClassesPlugin implements TransformerPlugin {
+public final class GenerateJLIClassesPlugin implements Plugin {
private static final String NAME = "generate-jli-classes";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
index fd7a37cf7b0..18a77753d2e 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java
@@ -44,7 +44,7 @@ import jdk.tools.jlink.plugin.LinkModule;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Plugin to explicitly specify the locale data included in jdk.localedata
@@ -68,7 +68,7 @@ import jdk.tools.jlink.plugin.TransformerPlugin;
* start with at least one white space character, e.g., " ar ar-EG ..."
* ^
*/
-public final class IncludeLocalesPlugin implements TransformerPlugin, ResourcePrevisitor {
+public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "include-locales";
private static final String MODULENAME = "jdk.localedata";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java
index ac67a5f6413..069be950c0b 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java
@@ -37,14 +37,14 @@ import java.util.function.ToIntFunction;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.Utils;
/**
*
* Order Resources plugin
*/
-public final class OrderResourcesPlugin implements TransformerPlugin {
+public final class OrderResourcesPlugin implements Plugin {
public static final String NAME = "order-resources";
private static final FileSystem JRT_FILE_SYSTEM = Utils.jrtFileSystem();
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
index 155243a2ebd..e47094ce1c4 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java
@@ -36,12 +36,12 @@ import jdk.tools.jlink.internal.Utils;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.Plugin.State;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* This plugin adds/deletes information for 'release' file.
*/
-public final class ReleaseInfoPlugin implements TransformerPlugin {
+public final class ReleaseInfoPlugin implements Plugin {
// option name
public static final String NAME = "release-info";
public static final String KEYS = "keys";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java
index 98cccd12051..97bd3a27413 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java
@@ -56,7 +56,7 @@ import jdk.internal.jimage.decompressor.CompressIndexes;
import jdk.internal.jimage.decompressor.SignatureParser;
import jdk.internal.jimage.decompressor.StringSharingDecompressor;
import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -68,7 +68,7 @@ import jdk.tools.jlink.internal.StringTable;
* A Plugin that stores the image classes constant pool UTF_8 entries into the
* Image StringsTable.
*/
-public class StringSharingPlugin implements TransformerPlugin, ResourcePrevisitor {
+public class StringSharingPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "compact-cp";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java
index 65eb1bb7404..325ec506301 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java
@@ -29,13 +29,13 @@ import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* Strip debug attributes plugin
*/
-public final class StripDebugPlugin implements TransformerPlugin {
+public final class StripDebugPlugin implements Plugin {
public static final String NAME = "strip-debug";
private final Predicate predicate;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java
index f70af29558a..4c3b7dc7950 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java
@@ -26,13 +26,13 @@ package jdk.tools.jlink.internal.plugins;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* Strip Native Commands plugin
*/
-public final class StripNativeCommandsPlugin implements TransformerPlugin {
+public final class StripNativeCommandsPlugin implements Plugin {
public static final String NAME = "strip-native-commands";
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java
index cc140664183..f12adb9af16 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java
@@ -52,7 +52,7 @@ import jdk.internal.org.objectweb.asm.Opcodes;
import static jdk.internal.org.objectweb.asm.Opcodes.*;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin.Builder.*;
import jdk.tools.jlink.plugin.ModuleEntry;
@@ -67,7 +67,7 @@ import jdk.tools.jlink.plugin.ModuleEntry;
* @see java.lang.module.SystemModuleFinder
* @see SystemModules
*/
-public final class SystemModuleDescriptorPlugin implements TransformerPlugin {
+public final class SystemModuleDescriptorPlugin implements Plugin {
private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
// TODO: packager has the dependency on the plugin name
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java
index 366ac079f4c..84c24559012 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java
@@ -34,13 +34,13 @@ import java.util.zip.Deflater;
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* ZIP Compression plugin
*/
-public final class ZipPlugin implements TransformerPlugin {
+public final class ZipPlugin implements Plugin {
public static final String NAME = "zip";
private Predicate predicate;
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java
index 52712172d5e..d99ec7bfcb5 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java
@@ -25,7 +25,7 @@
package jdk.tools.jlink.internal.plugins.asm;
import java.util.Objects;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.ModulePoolImpl;
@@ -35,7 +35,7 @@ import jdk.tools.jlink.internal.ModulePoolImpl;
* resources.
*
*/
-public abstract class AsmPlugin implements TransformerPlugin {
+public abstract class AsmPlugin implements Plugin {
public AsmPlugin() {
}
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java
index f748fa0f286..b83d5036954 100644
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java
@@ -57,29 +57,19 @@ public interface Plugin {
SORTER("SORTER"),
COMPRESSOR("COMPRESSOR"),
METAINFO_ADDER("METAINFO_ADDER"),
- VERIFIER("VERIFIER", true),
- PROCESSOR("PROCESSOR", true),
- PACKAGER("PACKAGER", true);
+ VERIFIER("VERIFIER"),
+ PROCESSOR("PROCESSOR"),
+ PACKAGER("PACKAGER");
private final String name;
- private final boolean postProcessor;
-
- Category(String name, boolean postProcessor) {
- this.name = name;
- this.postProcessor = postProcessor;
- }
Category(String name) {
- this(name, false);
+ this.name = name;
}
public String getName() {
return name;
}
-
- public boolean isPostProcessor() {
- return postProcessor;
- }
}
/**
@@ -209,4 +199,15 @@ public interface Plugin {
*/
public default void configure(Map config) {
}
+
+ /**
+ * Visit the content of the modules that are composing the image.
+ *
+ * @param in Read only content.
+ * @param out The pool to fill with content. This pool must contain
+ * the result of the visit.
+ *
+ * @throws PluginException
+ */
+ public void visit(ModulePool in, ModulePool out);
}
diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java
deleted file mode 100644
index 15133221c43..00000000000
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-
-/**
- * Implement this interface to develop a Transformer plugin.
- * TransformerPlugin are called during image creation. This kind of plugin aims to
- * modify the content of the runtime image.
- */
-public interface TransformerPlugin extends Plugin {
- /**
- * Visit the content of the modules that are composing the image.
- *
- * @param in Read only content.
- * @param out The pool to fill with content. This pool must contain
- * the result of the visit.
- *
- * @throws PluginException
- */
- public void visit(ModulePool in, ModulePool out);
-}
diff --git a/jdk/src/jdk.jlink/share/classes/module-info.java b/jdk/src/jdk.jlink/share/classes/module-info.java
index c23116404ac..b2ce1fd94bd 100644
--- a/jdk/src/jdk.jlink/share/classes/module-info.java
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java
@@ -29,20 +29,19 @@ module jdk.jlink {
requires jdk.internal.opt;
requires jdk.jdeps;
- uses jdk.tools.jlink.plugin.TransformerPlugin;
- uses jdk.tools.jlink.plugin.PostProcessorPlugin;
+ uses jdk.tools.jlink.plugin.Plugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.FileCopierPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.StripDebugPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludePlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.StripNativeCommandsPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.OptimizationPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.StripDebugPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludePlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.StripNativeCommandsPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.OptimizationPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
}
diff --git a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
index 1f65e09d087..f1e5f1da945 100644
--- a/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
+++ b/jdk/test/javax/net/ssl/Stapling/SSLSocketWithStapling.java
@@ -510,25 +510,27 @@ public class SSLSocketWithStapling {
sslc.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
SSLServerSocketFactory sslssf = sslc.getServerSocketFactory();
- SSLServerSocket sslServerSocket =
- (SSLServerSocket) sslssf.createServerSocket(serverPort);
- serverPort = sslServerSocket.getLocalPort();
+ try (SSLServerSocket sslServerSocket =
+ (SSLServerSocket) sslssf.createServerSocket(serverPort)) {
- /*
- * Signal Client, we're ready for his connect.
- */
- serverReady = true;
+ serverPort = sslServerSocket.getLocalPort();
- try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
- InputStream sslIS = sslSocket.getInputStream();
- OutputStream sslOS = sslSocket.getOutputStream()) {
- int numberIn = sslIS.read();
- int numberSent = 85;
- log("Server received number: " + numberIn);
- sslOS.write(numberSent);
- sslOS.flush();
- log("Server sent number: " + numberSent);
+ /*
+ * Signal Client, we're ready for his connect.
+ */
+ serverReady = true;
+
+ try (SSLSocket sslSocket = (SSLSocket) sslServerSocket.accept();
+ InputStream sslIS = sslSocket.getInputStream();
+ OutputStream sslOS = sslSocket.getOutputStream()) {
+ int numberIn = sslIS.read();
+ int numberSent = 85;
+ log("Server received number: " + numberIn);
+ sslOS.write(numberSent);
+ sslOS.flush();
+ log("Server sent number: " + numberSent);
+ }
}
}
diff --git a/jdk/test/sun/security/tools/keytool/standard.sh b/jdk/test/sun/security/tools/keytool/standard.sh
index 8106ee44dcb..2fb801ebd83 100644
--- a/jdk/test/sun/security/tools/keytool/standard.sh
+++ b/jdk/test/sun/security/tools/keytool/standard.sh
@@ -25,6 +25,7 @@
# @summary (almost) all keytool behaviors
# @author Weijun Wang
# @run shell/timeout=600 standard.sh
+# @key intermittent
#
# This test is always excecuted.
#
diff --git a/jdk/test/tools/jlink/DefaultProviderTest.java b/jdk/test/tools/jlink/DefaultProviderTest.java
index 9f4229a3451..7d8d43bce9e 100644
--- a/jdk/test/tools/jlink/DefaultProviderTest.java
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java
@@ -33,7 +33,6 @@ import jdk.tools.jlink.internal.PluginRepository;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import tests.Helper;
/*
@@ -60,7 +59,7 @@ public class DefaultProviderTest {
expectedOptions.put("option2", "value2");
}
- private static class Custom implements TransformerPlugin {
+ private static class Custom implements Plugin {
private boolean enabled = true;
@Override
diff --git a/jdk/test/tools/jlink/ImageFileCreatorTest.java b/jdk/test/tools/jlink/ImageFileCreatorTest.java
index 8e093c69459..c81888c7dfa 100644
--- a/jdk/test/tools/jlink/ImageFileCreatorTest.java
+++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java
@@ -37,7 +37,7 @@ import java.util.stream.Stream;
import jdk.tools.jlink.internal.Archive;
import jdk.tools.jlink.internal.ImageFileCreator;
import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.plugin.ModulePool;
@@ -220,7 +220,7 @@ public class ImageFileCreatorTest {
};
ImagePluginStack stack = new ImagePluginStack(noopBuilder, Collections.emptyList(),
- null, Collections.emptyList());
+ null);
ImageFileCreator.create(archives, ByteOrder.nativeOrder(), stack);
}
diff --git a/jdk/test/tools/jlink/IntegrationTest.java b/jdk/test/tools/jlink/IntegrationTest.java
index e321b08ffa4..0eb82a0415e 100644
--- a/jdk/test/tools/jlink/IntegrationTest.java
+++ b/jdk/test/tools/jlink/IntegrationTest.java
@@ -34,17 +34,17 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Function;
import jdk.tools.jlink.Jlink;
import jdk.tools.jlink.Jlink.JlinkConfiguration;
import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.builder.DefaultImageBuilder;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.internal.ExecutableImage;
+import jdk.tools.jlink.internal.PostProcessor;
import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
-import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
import tests.JImageGenerator;
@@ -70,7 +70,7 @@ public class IntegrationTest {
private static final List ordered = new ArrayList<>();
- public static class MyPostProcessor implements PostProcessorPlugin {
+ public static class MyPostProcessor implements PostProcessor, Plugin {
public static final String NAME = "mypostprocessor";
@@ -98,9 +98,14 @@ public class IntegrationTest {
public void configure(Map config) {
throw new UnsupportedOperationException("Shouldn't be called");
}
+
+ @Override
+ public void visit(ModulePool in, ModulePool out) {
+ in.transformAndCopy(Function.identity(), out);
+ }
}
- public static class MyPlugin1 implements TransformerPlugin {
+ public static class MyPlugin1 implements Plugin {
Integer index;
Set after;
diff --git a/jdk/test/tools/jlink/JLinkOptionsTest.java b/jdk/test/tools/jlink/JLinkOptionsTest.java
index 565c58bffa9..ea384f508a2 100644
--- a/jdk/test/tools/jlink/JLinkOptionsTest.java
+++ b/jdk/test/tools/jlink/JLinkOptionsTest.java
@@ -26,7 +26,7 @@ import java.util.Map;
import java.util.Set;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.PluginRepository;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
@@ -46,7 +46,7 @@ import tests.Helper;
*/
public class JLinkOptionsTest {
- private static class TestPlugin implements TransformerPlugin {
+ private static class TestPlugin implements Plugin {
private final String name;
private final String option;
diff --git a/jdk/test/tools/jlink/JLinkPostProcessingTest.java b/jdk/test/tools/jlink/JLinkPostProcessingTest.java
index c6da5dd97cc..cee0b5c4d08 100644
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java
@@ -28,10 +28,13 @@ import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.PluginRepository;
-import jdk.tools.jlink.plugin.ExecutableImage;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
+import jdk.tools.jlink.internal.PostProcessor;
+import jdk.tools.jlink.internal.ExecutableImage;
import tests.Helper;
/*
@@ -50,7 +53,7 @@ import tests.Helper;
*/
public class JLinkPostProcessingTest {
- private static class PPPlugin implements PostProcessorPlugin {
+ private static class PPPlugin implements PostProcessor, Plugin {
private static ExecutableImage called;
private static final String NAME = "pp";
@@ -67,6 +70,11 @@ public class JLinkPostProcessingTest {
return null;
}
+ @Override
+ public void visit(ModulePool in, ModulePool out) {
+ in.transformAndCopy(Function.identity(), out);
+ }
+
@Override
public String getName() {
return NAME;
diff --git a/jdk/test/tools/jlink/JLinkTest.java b/jdk/test/tools/jlink/JLinkTest.java
index 19b6e6a59d9..bf1a31d95a8 100644
--- a/jdk/test/tools/jlink/JLinkTest.java
+++ b/jdk/test/tools/jlink/JLinkTest.java
@@ -35,7 +35,6 @@ import java.util.List;
import java.util.stream.Stream;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.internal.PluginRepository;
import tests.Helper;
import tests.JImageGenerator;
@@ -60,7 +59,7 @@ public class JLinkTest {
private static int getNumJlinkPlugins() {
ModuleDescriptor desc = Plugin.class.getModule().getDescriptor();
return desc.provides().
- get(TransformerPlugin.class.getName()).
+ get(Plugin.class.getName()).
providers().size();
}
diff --git a/jdk/test/tools/jlink/customplugin/module-info.java b/jdk/test/tools/jlink/customplugin/module-info.java
index 63e227544ba..4b51ff86769 100644
--- a/jdk/test/tools/jlink/customplugin/module-info.java
+++ b/jdk/test/tools/jlink/customplugin/module-info.java
@@ -23,6 +23,6 @@
module customplugin {
requires jdk.jlink;
- provides jdk.tools.jlink.plugin.TransformerPlugin with plugin.HelloPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with plugin.CustomPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with plugin.HelloPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with plugin.CustomPlugin;
}
diff --git a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java
index 1b8b16b515b..45d54e8092b 100644
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java
@@ -27,9 +27,9 @@ import java.util.Map;
import java.util.function.Function;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
-public class CustomPlugin implements TransformerPlugin {
+public class CustomPlugin implements Plugin {
private final static String NAME = "custom-plugin";
diff --git a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java
index e37dee780d9..365544e7a39 100644
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java
@@ -29,12 +29,12 @@ import java.util.Collections;
import java.util.Map;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Custom plugin
*/
-public final class HelloPlugin implements TransformerPlugin {
+public final class HelloPlugin implements Plugin {
private static final String OUTPUT_FILE = "customplugin.txt";
public static final String NAME = "hello";
diff --git a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java
index ff616caa53c..43a25b0318f 100644
--- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java
@@ -61,7 +61,6 @@ import jdk.tools.jlink.internal.plugins.ZipPlugin;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class CompressorPluginTest {
@@ -279,9 +278,8 @@ public class CompressorPluginTest {
ModulePoolImpl inputResources,
ModuleEntry res,
List includesPatterns) {
- TransformerPlugin compressor = (TransformerPlugin) plugin;
ModulePool compressedModulePool = new ModulePoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable());
- compressor.visit(inputResources, compressedModulePool);
+ plugin.visit(inputResources, compressedModulePool);
String path = res.getPath();
ModuleEntry compressed = compressedModulePool.findEntry(path).get();
CompressedResourceHeader header
diff --git a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java
index b85d40e53e3..edc5d52a0fd 100644
--- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java
@@ -40,7 +40,6 @@ import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class ExcludeFilesPluginTest {
public static void main(String[] args) throws Exception {
diff --git a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
index d4e3b48afc9..03f453fda42 100644
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java
@@ -38,7 +38,6 @@ import jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class ExcludeVMPluginTest {
@@ -173,7 +172,7 @@ public class ExcludeVMPluginTest {
}
ModulePool out = new ModulePoolImpl();
- TransformerPlugin p = new ExcludeVMPlugin();
+ Plugin p = new ExcludeVMPlugin();
Map config = new HashMap<>();
if (vm != null) {
config.put(ExcludeVMPlugin.NAME, vm);
diff --git a/jdk/test/tools/jlink/plugins/LastSorterTest.java b/jdk/test/tools/jlink/plugins/LastSorterTest.java
index a15284dafa9..3f02c5172a6 100644
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java
@@ -45,7 +45,6 @@ import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class LastSorterTest {
@@ -167,7 +166,7 @@ public class LastSorterTest {
}
}
- public static class SorterPlugin implements TransformerPlugin {
+ public static class SorterPlugin implements Plugin {
private final String name;
private String starts;
diff --git a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java
index 5fc96d69d36..5cb5519bb63 100644
--- a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java
@@ -42,7 +42,7 @@ import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
public class OrderResourcesPluginTest {
@@ -93,7 +93,7 @@ public class OrderResourcesPluginTest {
ModulePool out = new ModulePoolImpl();
Map config = new HashMap<>();
config.put(OrderResourcesPlugin.NAME, "/zazou/**,**/module-info.class");
- TransformerPlugin p = new OrderResourcesPlugin();
+ Plugin p = new OrderResourcesPlugin();
p.configure(config);
p.visit(resources, out);
check(out.entries().collect(Collectors.toList()), sorted);
@@ -116,7 +116,7 @@ public class OrderResourcesPluginTest {
ModulePool out = new ModulePoolImpl();
Map config = new HashMap<>();
config.put(OrderResourcesPlugin.NAME, "@" + order.getAbsolutePath());
- TransformerPlugin p = new OrderResourcesPlugin();
+ Plugin p = new OrderResourcesPlugin();
p.configure(config);
p.visit(resources, out);
check(out.entries().collect(Collectors.toList()), sorted2);
diff --git a/jdk/test/tools/jlink/plugins/PluginOrderTest.java b/jdk/test/tools/jlink/plugins/PluginOrderTest.java
index 18178145e64..0116882c78f 100644
--- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java
+++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java
@@ -46,7 +46,6 @@ import jdk.tools.jlink.internal.PluginOrderingGraph;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PluginOrderTest {
@@ -225,7 +224,7 @@ public class PluginOrderTest {
PluginOrderingGraph.sort(plugins);
}
- private static class Plug implements TransformerPlugin {
+ private static class Plug implements Plugin {
private final Set isBefore;
private final Set isAfter;
diff --git a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java
index 3b533556582..679a0d058a0 100644
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java
@@ -44,7 +44,6 @@ import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PluginsNegativeTest {
@@ -117,7 +116,7 @@ public class PluginsNegativeTest {
}
}
- public static class CustomPlugin implements TransformerPlugin {
+ public static class CustomPlugin implements Plugin {
private final String name;
diff --git a/jdk/test/tools/jlink/plugins/PrevisitorTest.java b/jdk/test/tools/jlink/plugins/PrevisitorTest.java
index 019470c375b..273706e4487 100644
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java
@@ -49,7 +49,6 @@ import jdk.tools.jlink.Jlink;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PrevisitorTest {
@@ -107,7 +106,7 @@ public class PrevisitorTest {
}
}
- private static class CustomPlugin implements TransformerPlugin, ResourcePrevisitor {
+ private static class CustomPlugin implements Plugin, ResourcePrevisitor {
private static String NAME = "plugin";
diff --git a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java
index 58d63adcfd7..c8a93e0ed4b 100644
--- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java
@@ -57,7 +57,7 @@ import jdk.tools.jlink.internal.StringTable;
import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
import tests.JImageValidator;
@@ -119,7 +119,7 @@ public class StringSharingPluginTest {
try (java.util.stream.Stream stream = Files.walk(compiledClasses)) {
stream.forEach(c);
}
- TransformerPlugin plugin = new StringSharingPlugin();
+ Plugin plugin = new StringSharingPlugin();
ModulePoolImpl result = new ModulePoolImpl(resources.getByteOrder(), resources.getStringTable());
plugin.visit(resources, result);
diff --git a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java
index d3617db6f8a..86459b1c5bd 100644
--- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java
+++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java
@@ -58,7 +58,7 @@ import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
public class StripDebugPluginTest {
@@ -124,7 +124,7 @@ public class StripDebugPluginTest {
checkDebugAttributes(result1.getBytes());
}
- private ModuleEntry stripDebug(TransformerPlugin debug, ModuleEntry classResource,
+ private ModuleEntry stripDebug(Plugin debug, ModuleEntry classResource,
String path, String infoPath, byte[] moduleInfo) throws Exception {
ModulePool resources = new ModulePoolImpl();
resources.add(classResource);