# HG changeset patch # User ysuenaga # Date 1552739235 -32400 # Node ID 4985c8ca55b929a03f231d60745205b75c8cfbfb # Parent 5274462d57257f1528ac6ab95c2011647dd5d066 8220555: JFR tool shows potentially misleading message when it cannot access a file Reviewed-by: egahlin, mseledtsov diff -r 5274462d5725 -r 4985c8ca55b9 src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Command.java --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Command.java Sat Mar 16 02:08:10 2019 +0100 +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/tool/Command.java Sat Mar 16 21:27:15 2019 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -243,7 +243,7 @@ } rad.read(); // try to read 1 byte } catch (FileNotFoundException e) { - throw new UserDataException("could not find file '" + path + "'"); + throw new UserDataException("could not open file " + e.getMessage()); } catch (IOException e) { throw new UserDataException("i/o error reading file '" + path + "', " + e.getMessage()); } diff -r 5274462d5725 -r 4985c8ca55b9 test/jdk/jdk/jfr/tool/TestPrint.java --- a/test/jdk/jdk/jfr/tool/TestPrint.java Sat Mar 16 02:08:10 2019 +0100 +++ b/test/jdk/jdk/jfr/tool/TestPrint.java Sat Mar 16 21:27:15 2019 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -48,7 +48,7 @@ output.shouldContain("missing file"); output = ExecuteHelper.jfr("print", "missing.jfr"); - output.shouldContain("could not find file "); + output.shouldContain("could not open file "); Path file = Utils.createTempFile("faked-print-file", ".jfr"); FileWriter fw = new FileWriter(file.toFile());