RFR: 7329: Exception while opening Method Profile page.

Alex Macdonald aptmac at openjdk.java.net
Wed Jul 14 21:39:11 UTC 2021


On Wed, 14 Jul 2021 19:06:33 GMT, Suchita Chaturvedi <schaturvedi at openjdk.org> wrote:

> This PR addresses the null pointer exception issue.

application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/pages/internal/MethodWithFrameTypeLabelProvider.java line 109:

> 107: 				method = ((IMCFrame) key).getMethod();
> 108: 			}
> 109: 			if ((method != null) & (method.getModifier() != null)) {

Spotbugs:

Error:  High: Questionable use of non-short-circuit logic in org.openjdk.jmc.flightrecorder.ui.pages.internal.MethodWithFrameTypeLabelProvider.getImage(Object) [org.openjdk.jmc.flightrecorder.ui.pages.internal.MethodWithFrameTypeLabelProvider] At MethodWithFrameTypeLabelProvider.java:[line 109] NS_NON_SHORT_CIRCUIT

NS: Questionable use of non-short-circuit logic (NS_NON_SHORT_CIRCUIT)

This code seems to be using non-short-circuit logic (e.g., & or |) rather than short-circuit logic (&& or ||). Non-short-circuit logic causes both sides of the expression to be evaluated even when the result can be inferred from knowing the left-hand side. This can be less efficient and can result in errors if the left-hand side guards cases when evaluating the right-hand side can generate an error.

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

PR: https://git.openjdk.java.net/jmc/pull/277


More information about the jmc-dev mailing list