RFR: 8254345: com/sun/jdi/JdwpAttachTest.java reports error incorrectly

Chris Plummer cjplummer at openjdk.java.net
Mon Oct 12 21:42:18 UTC 2020


On Mon, 12 Oct 2020 21:03:55 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> Please review a trivial fix for JdwpAttachTest

I think you got this backward. `expectedResult` indicates whether or not a successful attach was expected. Since we are
not in the exception handling part of the code here, that means it did succeed, but the else part is handling the case
where we did not expect it to succeed. Therefore the error message is correct, basically saying the attached succeeded
but shouldn't have. However, if you look in the exception handling block, that's were the code message is wrong. That's
that code that is executed when the attach failed. If it was not expected to fail, the code should complain that it was
NOT able to attach, but instead it complains that it was able to attach.

You might want to change both messages to be a bit more clear. Something like "Attached succeeded but was expected to
fail" and "Attach failed but was expected to succeed".

-------------

Changes requested by cjplummer (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/619


More information about the serviceability-dev mailing list