Account for Java 8 in JVM options parsing
Java 8 presents the JVM options slightly differently when displaying via -XX:+PrintFlagsFinal. This commit adapts the JVM options parser for this possibility. Relates #42009
This commit is contained in:
parent
0b21fb0ee6
commit
7ee541546a
|
@ -68,7 +68,7 @@ final class JvmErgonomics {
|
|||
}
|
||||
|
||||
private static final Pattern OPTION =
|
||||
Pattern.compile("^\\s*\\S+\\s+(?<flag>\\S+)\\s+:?=\\s+(?<value>\\S+)?\\s+\\{[^}]+?\\}\\s+\\{[^}]+}");
|
||||
Pattern.compile("^\\s*\\S+\\s+(?<flag>\\S+)\\s+:?=\\s+(?<value>\\S+)?\\s+\\{[^}]+?\\}(\\s+\\{[^}]+})?");
|
||||
|
||||
static Map<String, Optional<String>> finalJvmOptions(
|
||||
final List<String> userDefinedJvmOptions) throws InterruptedException, IOException {
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.hamcrest.Matchers.anyOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
@ -71,7 +72,9 @@ public class JvmErgonomicsTests extends LaunchersTestCase {
|
|||
fail("expected starting java to fail");
|
||||
} catch (final RuntimeException e) {
|
||||
assertThat(e, hasToString(containsString(("starting java failed"))));
|
||||
assertThat(e, hasToString(containsString(("Too small maximum heap"))));
|
||||
assertThat(
|
||||
e,
|
||||
anyOf(hasToString(containsString("Too small initial heap")), hasToString(containsString("Too small maximum heap"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue