8220555: JFR tool shows potentially misleading message when it cannot access a file

Reviewed-by: egahlin, mseledtsov
This commit is contained in:
Yasumasa Suenaga 2019-03-16 21:27:15 +09:00
parent 7eebb86d2b
commit 1aa788a7b9
2 changed files with 4 additions and 4 deletions

View File

@ -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 @@ abstract class Command {
}
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());
}

View File

@ -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 @@ public class TestPrint {
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());