This commit is contained in:
Alejandro Murillo 2016-05-31 13:15:48 -07:00
commit 33bcb0a556
4 changed files with 66 additions and 53 deletions
jdk
src/java.base/share
conf/security
native/libjli
test
ProblemList.txt
sun/net/www/protocol/http

@ -33,6 +33,14 @@ grant codeBase "jrt:/jdk.crypto.ucrypto" {
permission java.io.FilePermission "${java.home}/conf/security/ucrypto-solaris.cfg", "read"; permission java.io.FilePermission "${java.home}/conf/security/ucrypto-solaris.cfg", "read";
}; };
grant codeBase "jrt:/java.sql" {
permission java.security.AllPermission;
};
grant codeBase "jrt:/java.sql.rowset" {
permission java.security.AllPermission;
};
grant codeBase "jrt:/jdk.crypto.ec" { grant codeBase "jrt:/jdk.crypto.ec" {
permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*"; permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
permission java.lang.RuntimePermission "loadLibrary.sunec"; permission java.lang.RuntimePermission "loadLibrary.sunec";

@ -108,6 +108,7 @@ static void SetAddExportsProp(const jint n, const char *s);
static void SetPatchProp(const jint n, const char *s); static void SetPatchProp(const jint n, const char *s);
static void SelectVersion(int argc, char **argv, char **main_class); static void SelectVersion(int argc, char **argv, char **main_class);
static void SetJvmEnvironment(int argc, char **argv); static void SetJvmEnvironment(int argc, char **argv);
static jboolean IsWhiteSpaceOptionArgument(const char* name);
static jboolean ParseArguments(int *pargc, char ***pargv, static jboolean ParseArguments(int *pargc, char ***pargv,
int *pmode, char **pwhat, int *pmode, char **pwhat,
int *pret, const char *jrepath); int *pret, const char *jrepath);
@ -499,6 +500,20 @@ JavaMain(void * _args)
LEAVE(); LEAVE();
} }
/*
* Test if the given option name has a whitespace separated argument.
*/
jboolean
IsWhiteSpaceOptionArgument(const char* name) {
return JLI_StrCmp(name, "-classpath") == 0 ||
JLI_StrCmp(name, "-cp") == 0 ||
JLI_StrCmp(name, "-modulepath") == 0 ||
JLI_StrCmp(name, "-mp") == 0 ||
JLI_StrCmp(name, "-upgrademodulepath") == 0 ||
JLI_StrCmp(name, "-addmods") == 0 ||
JLI_StrCmp(name, "-limitmods") == 0;
}
/* /*
* Checks the command line options to find which JVM type was * Checks the command line options to find which JVM type was
* specified. If no command line option was given for the JVM type, * specified. If no command line option was given for the JVM type,
@ -534,13 +549,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
continue; continue;
} }
} else { } else {
if (JLI_StrCmp(arg, "-classpath") == 0 || if (IsWhiteSpaceOptionArgument(arg)) {
JLI_StrCmp(arg, "-cp") == 0 ||
JLI_StrCmp(arg, "-modulepath") == 0 ||
JLI_StrCmp(arg, "-mp") == 0 ||
JLI_StrCmp(arg, "-upgrademodulepath") == 0 ||
JLI_StrCmp(arg, "-addmods") == 0 ||
JLI_StrCmp(arg, "-limitmods") == 0) {
newArgv[newArgvIdx++] = arg; newArgv[newArgvIdx++] = arg;
argi++; argi++;
if (argi < argc) { if (argi < argc) {
@ -682,9 +691,7 @@ SetJvmEnvironment(int argc, char **argv) {
if (i > 0) { if (i > 0) {
char *prev = argv[i - 1]; char *prev = argv[i - 1];
// skip non-dash arg preceded by class path specifiers // skip non-dash arg preceded by class path specifiers
if (*arg != '-' && if (*arg != '-' && IsWhiteSpaceOptionArgument(prev)) {
((JLI_StrCmp(prev, "-cp") == 0
|| JLI_StrCmp(prev, "-classpath") == 0))) {
continue; continue;
} }
@ -1028,9 +1035,7 @@ SelectVersion(int argc, char **argv, char **main_class)
} else { } else {
if (JLI_StrCmp(arg, "-jar") == 0) if (JLI_StrCmp(arg, "-jar") == 0)
jarflag = 1; jarflag = 1;
/* deal with "unfortunate" classpath syntax */ if (IsWhiteSpaceOptionArgument(arg) && (argc >= 2)) {
if ((JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) &&
(argc >= 2)) {
argc--; argc--;
argv++; argv++;
arg = *argv; arg = *argv;

@ -344,6 +344,13 @@ com/sun/jdi/CatchPatternTest.sh 8068645 generic-
com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-all com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-all
############################################################################
# jdk_time
java/time/test/java/time/TestClock_System.java 8158128 solaris-all
############################################################################ ############################################################################
# jdk_util # jdk_util

@ -24,9 +24,7 @@
/* /*
* @test * @test
* @bug 8027308 * @bug 8027308
* @key intermittent * @modules jdk.httpserver
* @modules java.base/sun.net.www.protocol.http
* jdk.httpserver
* @summary verifies that HttpURLConnection does not send the zone id in the * @summary verifies that HttpURLConnection does not send the zone id in the
* 'Host' field of the header: * 'Host' field of the header:
* Host: [fe80::a00:27ff:aaaa:aaaa] instead of * Host: [fe80::a00:27ff:aaaa:aaaa] instead of
@ -42,40 +40,41 @@ import java.io.IOException;
import java.net.*; import java.net.*;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import static java.lang.System.out;
import static java.net.Proxy.NO_PROXY;
public class ZoneId { public class ZoneId {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
InetAddress address = getAppropriateIPv6Address(); InetAddress address = getIPv6LookbackAddress();
if (address == null) { if (address == null) {
System.out.println( out.println("Cannot find the IPv6 loopback address. Skipping test.");
"The test will be skipped as not a single " +
"appropriate IPv6 address was found on this machine");
return; return;
} }
String ip6_literal = address.getHostAddress(); String ip6_literal = address.getHostAddress();
System.out.println("Found an appropriate IPv6 address: " + address); out.println("Found an appropriate IPv6 address: " + address);
System.out.println("Starting http server..."); out.println("Starting http server...");
HttpServer server = HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
HttpServer.create(new InetSocketAddress(address, 0), 0);
CompletableFuture<Headers> headers = new CompletableFuture<>(); CompletableFuture<Headers> headers = new CompletableFuture<>();
server.createContext("/", createCapturingHandler(headers)); server.createContext("/", createCapturingHandler(headers));
server.start(); server.start();
System.out.println("Started at " + server.getAddress()); out.println("Started at " + server.getAddress());
try { try {
String spec = "http://[" + address.getHostAddress() + "]:" + server.getAddress().getPort(); int port = server.getAddress().getPort();
System.out.println("Client is connecting to: " + spec); String spec = "http://[" + address.getHostAddress() + "]:" + port;
URLConnection urlConnection = new URL(spec).openConnection(); out.println("Client is connecting to: " + spec);
((sun.net.www.protocol.http.HttpURLConnection) urlConnection) URL url = new URL(spec);
.getResponseCode(); HttpURLConnection uc = (HttpURLConnection)url.openConnection(NO_PROXY);
uc.getResponseCode();
} finally { } finally {
System.out.println("Shutting down the server..."); out.println("Shutting down the server...");
server.stop(0); server.stop(0);
} }
@ -83,7 +82,7 @@ public class ZoneId {
String ip6_address = ip6_literal.substring(0, idx); String ip6_address = ip6_literal.substring(0, idx);
List<String> hosts = headers.get().get("Host"); List<String> hosts = headers.get().get("Host");
System.out.println("Host: " + hosts); out.println("Host: " + hosts);
if (hosts.size() != 1 || hosts.get(0).contains("%") || if (hosts.size() != 1 || hosts.get(0).contains("%") ||
!hosts.get(0).contains(ip6_address)) { !hosts.get(0).contains(ip6_address)) {
@ -91,33 +90,27 @@ public class ZoneId {
} }
} }
private static InetAddress getAppropriateIPv6Address() throws SocketException { static InetAddress getIPv6LookbackAddress() throws SocketException {
System.out.println("Searching through the network interfaces..."); out.println("Searching for the IPv6 loopback address...");
Enumeration<NetworkInterface> is = NetworkInterface.getNetworkInterfaces(); Enumeration<NetworkInterface> is = NetworkInterface.getNetworkInterfaces();
// The IPv6 loopback address contains a scope id, and is "connect-able".
while (is.hasMoreElements()) { while (is.hasMoreElements()) {
NetworkInterface i = is.nextElement(); NetworkInterface i = is.nextElement();
System.out.println("\tinterface: " + i); if (!i.isLoopback())
// just a "good enough" marker that the interface
// does not support a loopback and therefore should not be used
if ( i.getHardwareAddress() == null) continue;
if (!i.isUp()) continue;
Enumeration<InetAddress> as = i.getInetAddresses();
while (as.hasMoreElements()) {
InetAddress a = as.nextElement();
System.out.println("\t\taddress: " + a.getHostAddress());
if ( !(a instanceof Inet6Address &&
a.toString().contains("%")) ) {
continue; continue;
Optional<InetAddress> addr = i.inetAddresses()
.filter(x -> x instanceof Inet6Address)
.filter(y -> y.toString().contains("%"))
.findFirst();
if (addr.isPresent())
return addr.get();
} }
return a;
}
}
return null; return null;
} }
private static HttpHandler createCapturingHandler(CompletableFuture<Headers> headers) { static HttpHandler createCapturingHandler(CompletableFuture<Headers> headers) {
return new HttpHandler() { return new HttpHandler() {
@Override @Override
public void handle(HttpExchange exchange) throws IOException { public void handle(HttpExchange exchange) throws IOException {