# HG changeset patch # User gadams # Date 1515886415 18000 # Node ID d53732d23ade3bb653cf1c3937eb7f3bf64fc3df # Parent fb56735cb46aaf6349900705ded4c0e0b863442d 8031482: Some jcmds generate output with a \n as a separator rather than \r\n on Windows Reviewed-by: cjplummer, sspitsyn, dholmes diff -r fb56735cb46a -r d53732d23ade test/jdk/ProblemList.txt --- a/test/jdk/ProblemList.txt Fri Jan 12 14:33:00 2018 -0800 +++ b/test/jdk/ProblemList.txt Sat Jan 13 18:33:35 2018 -0500 @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2018, 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 @@ -351,8 +351,6 @@ # svc_tools -sun/tools/jcmd/TestJcmdSanity.java 8031482 windows-all - sun/tools/jstat/jstatClassloadOutput1.sh 8173942 generic-all sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java 8057732 generic-all diff -r fb56735cb46a -r d53732d23ade test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java --- a/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Fri Jan 12 14:33:00 2018 -0800 +++ b/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Sat Jan 13 18:33:35 2018 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, 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 @@ -25,12 +25,16 @@ import static jdk.testlibrary.Asserts.*; +import java.io.BufferedReader; import java.io.IOException; import java.io.PrintStream; +import java.io.StringReader; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; + /** * Utility class for verifying output and exit value from a {@code Process}. @@ -446,8 +450,9 @@ /** - * Get the contents of the output buffer (stdout and stderr) as list of strings. - * Output will be split by system property 'line.separator'. + * Get the contents of the output buffer (stdout and stderr) + * as a list of strings. Output will be split at new-lines as + * recognized by java.io.BufferedReader.readLine(). * * @return Contents of the output buffer as list of strings */ @@ -456,12 +461,8 @@ } private List asLines(String buffer) { - List l = new ArrayList<>(); - String[] a = buffer.split(Utils.NEW_LINE); - for (String string : a) { - l.add(string); - } - return l; + return new BufferedReader(new StringReader(buffer)) + .lines().collect(Collectors.toList()); } /**