changeset 14658:1ac38ddb865c

8220555: JFR tool shows potentially misleading message when it cannot access a file Reviewed-by: egahlin, mseledtsov
author ysuenaga
date Sat, 16 Mar 2019 21:27:15 +0900
parents 0d51b3ba8061
children 87091b543626
files src/share/classes/jdk/jfr/internal/tool/Command.java test/jdk/jfr/tool/TestPrint.java
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/jdk/jfr/internal/tool/Command.java	Fri Apr 10 11:35:49 2015 +0300
+++ b/src/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());
         }
--- a/test/jdk/jfr/tool/TestPrint.java	Fri Apr 10 11:35:49 2015 +0300
+++ b/test/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
@@ -47,7 +47,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());