[9] RFR: 8076486: javax/security/auth/Subject/doAs/NestedActions.java fails if extra VM options are given

Artem Smotrakov artem.smotrakov at oracle.com
Tue May 5 16:01:35 UTC 2015


Hi Max,

It works fine if a sting starts with a whitespace. It looks like that 
jtreg removes whitespaces. Here is a command to run the test, and a 
piece of jtr file:

${JAVA_HOME}/bin/java -jar /home/artem/tools/jtreg/4.1/lib/jtreg.jar -a 
-v -testjdk ${JAVA_HOME} -javaoptions:"     -XX:+UseG1GC 
-XX:+CreateMinidumpOnCrash     " 
-dir:/home/artem/ws/jdk/jdk9_dev_jaas_nested_action_tests/jdk/test 
javax/security/auth/Subject/doAs/NestedActions.java

...
/home/artem/jdk/jdk1.9.0b61/bin/java \\
         -Dtest.vm.opts= \\
         -Dtest.jdk=/home/artem/jdk/jdk1.9.0b61 \\
         -Dtest.timeout.factor=1.0 \\
-Dtest.src.path=/home/artem/ws/jdk/jdk9_dev_jaas_nested_action_tests/jdk/test/javax/security/auth/Subject/doAs:/home/artem/ws/jdk/jdk9_dev_jaas_nested_action_tests/jdk/test/lib/testlibrary 
\\
         -Dtest.compiler.opts= \\
         -Dcompile.jdk=/home/artem/jdk/jdk1.9.0b61 \\
-Dtest.classes=/home/artem/results/jaas_nested_action_tests/JTwork/classes/javax/security/auth/Subject/doAs 
\\
-Dtest.class.path=/home/artem/results/jaas_nested_action_tests/JTwork/classes/javax/security/auth/Subject/doAs:/home/artem/results/jaas_nested_action_tests/JTwork/classes/lib/testlibrary 
\\
         -Dtest.java.opts='-XX:+UseG1GC -XX:+CreateMinidumpOnCrash' \\
-Dtest.src=/home/artem/ws/jdk/jdk9_dev_jaas_nested_action_tests/jdk/test/javax/security/auth/Subject/doAs 
\\
         -Dtest.tool.vm.opts= \\
         -XX:+UseG1GC -XX:+CreateMinidumpOnCrash \\
         com.sun.javatest.regtest.MainWrapper 
/home/artem/results/jaas_nested_action_tests/JTwork/classes/javax/security/auth/Subject/doAs/NestedActions.jta 
NestedActionsTwoPrincipals policy.two.principals 
NestedActionsTwoPrincipals.jar WriteToFileAction.jar 
ReadFromFileAction.jar ReadPropertyAction.jar
...

But anyway, I added trim(), so now the test doesn't rely on jtreg. 
Please take a look:

http://cr.openjdk.java.net/~asmotrak/8076486/webrev.02/

Artem

On 05/04/2015 11:49 AM, Weijun Wang wrote:
> Artem
>
> If a string starts with whitespace(s), the first element of 
> split("\\s+") will be an empty string. If you can be sure JAVA_OPTS 
> does not have them, your code change is fine.
>
> Thanks
> Max
>
> On 4/29/2015 11:44 PM, Artem Smotrakov wrote:
>> Hi Max,
>>
>> These fancy things sometimes make me forget about simpler ways :-)
>>
>> Please take a look
>>
>> http://cr.openjdk.java.net/~asmotrak/8076486/webrev.01/
>>
>> Thanks!
>>
>> Artem
>>
>> On 04/29/2015 05:04 PM, Weijun Wang wrote:
>>> Maybe you can call JAVA_OPTS.trim().split("\\s+") to avoid the 
>>> filtering.
>>>
>>> And it seems Collections.addAll() can add an array to a list.
>>>
>>> Of course, you are free to exercise any fancy jdk8 features. :-)
>>>
>>> Thanks
>>> Max
>>>
>>> On 4/29/2015 3:23 PM, Artem Smotrakov wrote:
>>>> Hello,
>>>>
>>>> Please review this fix for
>>>> javax/security/auth/Subject/doAs/NestedActions.java test.
>>>>
>>>> The test runs java in a separate process. It fails if multiple java
>>>> options are passed because ProcessBuilder expects each parameter to be
>>>> put in to a separate array element, but the test didn't do that. I
>>>> updated the test to split java option string, and put each option in a
>>>> separate array element.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8076486
>>>> Webrev: http://cr.openjdk.java.net/~asmotrak/8076486/webrev.00/
>>>>
>>>> Artem
>>



More information about the security-dev mailing list