From maakoulimane at gmail.com Thu Sep 8 11:19:16 2016 From: maakoulimane at gmail.com (EL MAAKOUL IMANE) Date: Thu, 8 Sep 2016 13:19:16 +0200 Subject: java/net/SetFactoryPermission/SetFactoryPermission.java fails with error "factory already defined" Message-ID: Hello, When running Jtreg test suite with jdk9, the test: java/net/SetFactoryPermission/SetFactoryPermission.java fails with the exception: java.lang.Error: factory already defined This error only happens when: java/net/HandlerLoop.java is run before java/net/SetFactoryPermission/SetFactoryPermission.java within the same agent. This is explained by the fact that in java/net/HandlerLoop.java calls the setter URL.setURLStreamHandlerFactory is called with a non-null parameter, which can be called only once in a JVM instance according to the JAVA API. Consequently the VM that runs java/net/HandlerLoop.java is invalid for running java/net/SetFactoryPermission/SetFactoryPermission.java. To solve that problem, an annotation could be added to the test java/net/HandlerLoop.java to tell Jtreg runner to spawn a new VM for that test. Note: This is reproducible using the -agentvm and setting the concurrency to 1 and also renaming the package of one of the tests to force it to be executed first. Reproducible always with jdk9. Best regards, Imane EL Maakoul -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean.coffey at oracle.com Thu Sep 8 14:21:48 2016 From: sean.coffey at oracle.com (Sean Coffey) Date: Thu, 8 Sep 2016 15:21:48 +0100 Subject: java/net/SetFactoryPermission/SetFactoryPermission.java fails with error "factory already defined" In-Reply-To: References: Message-ID: <7c5947bf-b3e9-5ff7-6b1a-42b201439cad@oracle.com> Good point. That test should be run in other vm mode. I've logged https://bugs.openjdk.java.net/browse/JDK-8165711 We can do the code review on net-dev mailing list. regards, Sean. On 08/09/2016 12:19, EL MAAKOUL IMANE wrote: > Hello, > > When running Jtreg test suite with jdk9, the test: > java/net/SetFactoryPermission/SetFactoryPermission.java fails with the > exception: > java.lang.Error: factory already defined > > This error only happens when: java/net/HandlerLoop.java is run before > java/net/SetFactoryPermission/SetFactoryPermission.java within the > same agent. This is explained by the fact that in > java/net/HandlerLoop.java calls the setter > URL.setURLStreamHandlerFactory is called with a non-null parameter, > which can be called only once in a JVM instance according to the JAVA API. > > Consequently the VM that runs java/net/HandlerLoop.java is invalid for > runningjava/net/SetFactoryPermission/SetFactoryPermission.java. > > To solve that problem, an annotation could be added to the test > java/net/HandlerLoop.java to tell Jtreg runner to spawna new VM for > that test. > > > Note: This is reproducible using the -agentvm and setting the > concurrency to 1 and also renaming > the package of one of the tests to force it to be executed first. > Reproducible always with jdk9. > > Best regards, > Imane EL Maakoul -------------- next part -------------- An HTML attachment was scrubbed... URL: