RFR: 8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

Chris Plummer-2
The test is checking for "cannot be cast to" because at one point there was a bug in `printall` that was causing a `ClassCastException`. See [JDK-8175384](https://bugs.openjdk.java.net/browse/JDK-8175384). However, there is also a "cannot be cast to" message in the `printall` output when disassembling since the java source actually has it in a string literal:

 3203 302 ldc #214(6) <String " cannot be cast to ResourceBundle"> [fast_aldc]

Which comes from the following in the ResourceBundle.java source:

                        throw new ClassCastException(c.getName()
                                + " cannot be cast to ResourceBundle");

So this occurrence of "cannot be cast" is fine. The one we don't want comes from `SharedRuntime::generate_class_cast_message()` in `sharedRuntime.cpp`:

`                 "class %s cannot be cast to class %s (%s%s%s)",`

So we can avoid this bug by changing the check to be a bit more explicit and check for "cannot be cast to class" instead.

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

Commit messages:
 - Be more specific about the "cannot be cast" message the test looks for

Changes: https://git.openjdk.java.net/jdk/pull/2624/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2624&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8261857
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2624.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2624/head:pull/2624

PR: https://git.openjdk.java.net/jdk/pull/2624
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

Serguei Spitsyn-2
On Thu, 18 Feb 2021 06:13:27 GMT, Chris Plummer <[hidden email]> wrote:

> The test is checking for "cannot be cast to" because at one point there was a bug in `printall` that was causing a `ClassCastException`. See [JDK-8175384](https://bugs.openjdk.java.net/browse/JDK-8175384). However, there is also a "cannot be cast to" message in the `printall` output when disassembling since the java source actually has it in a string literal:
>
>  3203 302 ldc #214(6) <String " cannot be cast to ResourceBundle"> [fast_aldc]
>
> Which comes from the following in the ResourceBundle.java source:
>
>                         throw new ClassCastException(c.getName()
>                                 + " cannot be cast to ResourceBundle");
>
> So this occurrence of "cannot be cast" is fine. The one we don't want comes from `SharedRuntime::generate_class_cast_message()` in `sharedRuntime.cpp`:
>
> `                 "class %s cannot be cast to class %s (%s%s%s)",`
>
> So we can avoid this bug by changing the check to be a bit more explicit and check for "cannot be cast to class" instead.

This looks good and trivial.

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

Marked as reviewed by sspitsyn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2624
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

Chris Plummer-2
On Sat, 20 Feb 2021 10:21:52 GMT, Serguei Spitsyn <[hidden email]> wrote:

>> The test is checking for "cannot be cast to" because at one point there was a bug in `printall` that was causing a `ClassCastException`. See [JDK-8175384](https://bugs.openjdk.java.net/browse/JDK-8175384). However, there is also a "cannot be cast to" message in the `printall` output when disassembling since the java source actually has it in a string literal:
>>
>>  3203 302 ldc #214(6) <String " cannot be cast to ResourceBundle"> [fast_aldc]
>>
>> Which comes from the following in the ResourceBundle.java source:
>>
>>                         throw new ClassCastException(c.getName()
>>                                 + " cannot be cast to ResourceBundle");
>>
>> So this occurrence of "cannot be cast" is fine. The one we don't want comes from `SharedRuntime::generate_class_cast_message()` in `sharedRuntime.cpp`:
>>
>> `                 "class %s cannot be cast to class %s (%s%s%s)",`
>>
>> So we can avoid this bug by changing the check to be a bit more explicit and check for "cannot be cast to class" instead.
>
> This looks good and trivial.

Thanks Serguei!

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

PR: https://git.openjdk.java.net/jdk/pull/2624
Reply | Threaded
Open this post in threaded view
|

Integrated: 8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

Chris Plummer-2
In reply to this post by Chris Plummer-2
On Thu, 18 Feb 2021 06:13:27 GMT, Chris Plummer <[hidden email]> wrote:

> The test is checking for "cannot be cast to" because at one point there was a bug in `printall` that was causing a `ClassCastException`. See [JDK-8175384](https://bugs.openjdk.java.net/browse/JDK-8175384). However, there is also a "cannot be cast to" message in the `printall` output when disassembling since the java source actually has it in a string literal:
>
>  3203 302 ldc #214(6) <String " cannot be cast to ResourceBundle"> [fast_aldc]
>
> Which comes from the following in the ResourceBundle.java source:
>
>                         throw new ClassCastException(c.getName()
>                                 + " cannot be cast to ResourceBundle");
>
> So this occurrence of "cannot be cast" is fine. The one we don't want comes from `SharedRuntime::generate_class_cast_message()` in `sharedRuntime.cpp`:
>
> `                 "class %s cannot be cast to class %s (%s%s%s)",`
>
> So we can avoid this bug by changing the check to be a bit more explicit and check for "cannot be cast to class" instead.

This pull request has now been integrated.

Changeset: c2509ea9
Author:    Chris Plummer <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/c2509ea9
Stats:     2 lines in 1 file changed: 0 ins; 0 del; 2 mod

8261857: serviceability/sa/ClhsdbPrintAll.java failed with "Test ERROR java.lang.RuntimeException: 'cannot be cast to' found in stdout"

Reviewed-by: sspitsyn

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

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