[jdk8u-dev] RFR: 8298108: Add a regression test for JDK-8297684 [v2]

Severin Gehwolf sgehwolf at openjdk.org
Tue Apr 11 16:27:46 UTC 2023


On Sat, 8 Apr 2023 14:19:20 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> If you override the property, it will only contain what you pass it:
>> 
>> 
>> $ /usr/lib/jvm/java-1.8.0-openjdk/bin/java -Djava.ext.dirs=/foo -XshowSettings:properties -version 2>&1 | grep java.ext.dirs
>>     java.ext.dirs = /foo
>> $ /usr/lib/jvm/java-1.8.0-openjdk/bin/java -XshowSettings:properties -version 2>&1 | grep java.ext.dirs
>>     java.ext.dirs = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b09-2.fc37.x86_64/jre/lib/ext
>> 
>> 
>> The intention is to use the extra dir as well, but it should also use `${java.home}/ext`
>
> Yeah, I get that, but I'm talking about the simpler issue of including the value of `System.getProperty("java.home")` twice, once in `extDir` and then again in the string passed to `testRun.add`.
> 
> If I break out the code into a test file,
> 
> ~~~
> $ cat TestExt.java
> import java.io.File;
> 
> import java.nio.file.Path;
> import java.nio.file.Paths;
> 
> import java.util.ArrayList;
> import java.util.List;
> 
> public class TestExt
> {
>     private static final Path MODS_DIR = Paths.get("mods");
> 
>     public static void main(String[] args) {
> 	// run test, which must not throw a NPE
> 	List<String> testRun = new ArrayList<>();
> 	String extDir = System.getProperty("java.home") + File.separator + "lib" + File.separator + "ext";
> 	testRun.add("-Djava.ext.dirs=" + System.getProperty("java.home") + extDir + File.pathSeparator + MODS_DIR.toAbsolutePath().toString());
> 	System.out.println(testRun);
>     }
> }
> $ $HOME/build/icedtea8/bin/java -version
> openjdk version "1.8.0_362"
> OpenJDK Runtime Environment (IcedTea 3.26.0) (Gentoo build 1.8.0_362-b09)
> OpenJDK 64-Bit Server VM (build 25.362-b09, mixed mode)
> $ $HOME/build/icedtea8/bin/javac TestExt.java 
> $ $HOME/build/icedtea8/bin/java TestExt
> [-Djava.ext.dirs=/home/andrew/build/icedtea8/jre/home/andrew/build/icedtea8/jre/lib/ext:/tmp/mods]
> ~~~
> 
> You can see the value passed includes `java.home` twice. I guess it's not causing an issue with the test because it doesn't actually need to use any of the extensions in the system extension directory.

I see what you mean. Should be fixed now. Thanks!

-------------

PR Review Comment: https://git.openjdk.org/jdk8u-dev/pull/269#discussion_r1163058258


More information about the jdk8u-dev mailing list