RFR: 5608: Include top stack trace frames in errors and exceptions rules [v2]

Marcus Hirt hirt at openjdk.org
Fri Sep 19 11:55:30 UTC 2025


On Fri, 19 Sep 2025 11:48:11 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> Aymane Harmaz has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adding most common error and exceprion message
>
> core/org.openjdk.jmc.flightrecorder.rules.jdk/src/main/resources/org/openjdk/jmc/flightrecorder/rules/jdk/messages/internal/messages.properties line 252:
> 
>> 250: ExceptionRule_TEXT_MOST_COMMON_EXCEPTION_MESSAGE=The most common exception message was : \n {mostCommonExceptionMessage}
>> 251: #{mostCommonExceptionStacktrace} is a string.
>> 252: ExceptionRule_TEXT_MOST_COMMON_EXCEPTION_STACKTRACE=The most common exception stacktrace was : \n {mostCommonExceptionStacktrace}
> 
> No space before colon.

And stack trace.

> core/org.openjdk.jmc.flightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java line 1450:
> 
>> 1448: 	 * @return stack trace frames
>> 1449: 	 */
>> 1450: 	public static String getTopNFramesInMostCommonTrace(IItemCollection items, int n) {
> 
> Maybe add a small shim for people that might already use it outside of JMC?
> 
> public static String getSecondFrameInMostCommonTrace(IItemCollection items) {
> 	String frames = getTopNFramesInMostCommonTrace(items, 2);
> 	String[] parts = frames.split("\n");
> 	return parts.length >= 2 ? parts[1] : frames;
> }

You might also want for the Autoboxing rule to use the shim. :)

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

PR Review Comment: https://git.openjdk.org/jmc/pull/674#discussion_r2362647085
PR Review Comment: https://git.openjdk.org/jmc/pull/674#discussion_r2362630174


More information about the jmc-dev mailing list