8240555: Using env of JAVA_TOOL_OPTIONS and _JAVA_OPTIONS breaks QuietOption.java test

Reviewed-by: shurailine, prappo
This commit is contained in:
Jonathan Gibbons 2020-03-12 14:14:29 -07:00
parent 5bc78c438b
commit 2eaeb20697

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
@ -65,6 +66,18 @@ public class QuietOption {
"-quiet",
new File(testSrc, thisClassName + ".java").getPath());
if (!output.isEmpty()) {
// Remove any lines that might have been generated by the runtime
Iterator<String> iter = output.iterator();
while (iter.hasNext()) {
String line = iter.next();
if (line.matches("^Picked up .*JAVA.*OPTIONS:.*")) {
System.out.println("IGNORING: " + line);
iter.remove();
}
}
}
if (!output.isEmpty()) {
System.out.println(output);
throw new Exception("run1: Shhh!, very chatty javadoc!.");