You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using the Netbeans/OpenIDE platform as the underlying framework for our application, STAR-CCM+. Some time ago, one of our testing engineers ran across an issue in which an embedded window is floated and docked several times. See attached screen recording.
java.lang.Integer.intValue.mp4
From the stack trace (see attached), one can see that the problem originates in the getModeTopComponentPreviousIndex() method defined in the DefaultModel class (part of the org.netbeans.core.windows.model package).
/** Gets the tab index of the given top component before it was moved to sliding/separate mode */
@Override
public int getModeTopComponentPreviousIndex(ModeImpl mode, String tcID) {
ModeModel modeModel = getModelForMode(mode);
return modeModel == null ? null : modeModel.getTopComponentPreviousIndex(tcID);
}
... it is possible that the modeModel variable can be null, and the return statement tries to accommodate for this possibility; however, in this case it tries to return a value null from the method. The compiler appears to allocate an Integer variable for this, then unboxes into an int. But the problem is that the value in the Integer is null, and the call to Integer::intValue() fails.
Language / Project Type / NetBeans Component
Netbeans/OpenIDE platform
How to reproduce
I can reproduce this in our application; however, I do not have a stand-alone example external of our application that I can provide. (And, quite honestly, I'm not sure how to create a small demonstrable platform-based application, let alone one that will reliably reproduce the problem.)
I've tried reproducing in the Netbeans IDE, but as yet have not been able to do so. It is possible that our application exposes a situation that does not normally occur otherwise. Nevertheless, you can see the reproduction from the attached video, and you can see in the code for DefaultModel where and under condition it occurs.
Did this work correctly in an earlier version?
No / Don't know
Operating System
We've seen this in Windows 10 and Linux CentOS 7.9. Have not tried under later versions.
JDK
Originally observed using JDK 17
Apache NetBeans packaging
Apache NetBeans platform
Anything else
I've been able to mitigate this for our application by adjusting our own copy of the platform code such that it returns a value -1 rather than null, so this does not seem to be an issue for us any longer. However, as far as I can tell in GitHub, the code in which the runtime could try to unbox a nullInteger still exists, whether or not it will actually be exercised in a real application.
I'm not sure off-hand what a 'correct' value should be returned from the method if the modeModel is null, or perhaps whether it might be more appropriate to adjust the return type on the method to Integer, thus avoiding the unboxing operation.
In any event, I thought I should bring this to your attention.
Apache NetBeans version
Apache NetBeans 30
What happened
We're using the Netbeans/OpenIDE platform as the underlying framework for our application, STAR-CCM+. Some time ago, one of our testing engineers ran across an issue in which an embedded window is floated and docked several times. See attached screen recording.
java.lang.Integer.intValue.mp4
From the stack trace (see attached), one can see that the problem originates in the
getModeTopComponentPreviousIndex()method defined in the DefaultModel class (part of the org.netbeans.core.windows.model package).StackTrace.txt
Looking at the source code...
... it is possible that the
modeModelvariable can benull, and thereturnstatement tries to accommodate for this possibility; however, in this case it tries to return a valuenullfrom the method. The compiler appears to allocate anIntegervariable for this, then unboxes into anint. But the problem is that the value in theIntegerisnull, and the call toInteger::intValue()fails.Language / Project Type / NetBeans Component
Netbeans/OpenIDE platform
How to reproduce
I can reproduce this in our application; however, I do not have a stand-alone example external of our application that I can provide. (And, quite honestly, I'm not sure how to create a small demonstrable platform-based application, let alone one that will reliably reproduce the problem.)
I've tried reproducing in the Netbeans IDE, but as yet have not been able to do so. It is possible that our application exposes a situation that does not normally occur otherwise. Nevertheless, you can see the reproduction from the attached video, and you can see in the code for
DefaultModelwhere and under condition it occurs.Did this work correctly in an earlier version?
No / Don't know
Operating System
We've seen this in Windows 10 and Linux CentOS 7.9. Have not tried under later versions.
JDK
Originally observed using JDK 17
Apache NetBeans packaging
Apache NetBeans platform
Anything else
I've been able to mitigate this for our application by adjusting our own copy of the platform code such that it returns a value -1 rather than
null, so this does not seem to be an issue for us any longer. However, as far as I can tell in GitHub, the code in which the runtime could try to unbox anullIntegerstill exists, whether or not it will actually be exercised in a real application.I'm not sure off-hand what a 'correct' value should be returned from the method if the
modeModelisnull, or perhaps whether it might be more appropriate to adjust the return type on the method toInteger, thus avoiding the unboxing operation.In any event, I thought I should bring this to your attention.
Are you willing to submit a pull request?
No