AlfaSack opened a new issue, #9398:
URL: https://github.com/apache/netbeans/issues/9398
### Apache NetBeans version
Apache NetBeans 29
### What happened
### Apache NetBeans version
Apache NetBeans 29
### What happened
Opening any `.jsp` file via the Projects window causes the editor tab to
flash open and immediately close. The IDE log shows a `NullPointerException` in
`JspParserImpl.createParseProxy(JspParserImpl.java:234)`:
```
java.lang.NullPointerException: Cannot invoke
"org.netbeans.api.j2ee.core.Profile.isAtLeast(org.netbeans.api.j2ee.core.Profile)"
because the return value of
"org.netbeans.modules.web.api.webmodule.WebModule.getJ2eeProfile()" is null
at
org.netbeans.modules.web.jspparser.JspParserImpl.createParseProxy(JspParserImpl.java:234)
at
org.netbeans.modules.web.jspparser.JspParserImpl.getParseProxy(JspParserImpl.java:225)
at
org.netbeans.modules.web.jspparser.JspParserImpl.getJspOpenInfo(JspParserImpl.java:177)
at
org.netbeans.modules.web.core.jsploader.TagLibParseSupport.getCachedOpenInfo(TagLibParseSupport.java:246)
at
org.netbeans.modules.web.core.jsploader.JspDataObject.findFileEncoding(JspDataObject.java:287)
at
org.netbeans.modules.web.core.jsploader.JspDataObject.getFileEncoding(JspDataObject.java:276)
at
org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.verifyEncoding(BaseJspEditorSupport.java:276)
at
org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.open(BaseJspEditorSupport.java:257)
at org.openide.actions.OpenAction.performAction(OpenAction.java:59)
...
```
A follow-up `IllegalStateException` is then logged from
`BaseJspEditorSupport$4.propertyChange` during the resulting document-close
cleanup, which is why the tab disappears instantly:
```
INFO [org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4]:
property change fired with both new and old value null!
java.lang.IllegalStateException
at
org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4.propertyChange(BaseJspEditorSupport.java:166)
...
at
org.openide.text.DocumentOpenClose$DocumentClose.run(DocumentOpenClose.java:985)
```
Root cause appears to be that `JspParserImpl.createParseProxy` calls
`webModule.getJ2eeProfile().isAtLeast(...)` without guarding against
`getJ2eeProfile()` returning `null`. `WebModule.getJ2eeProfile()` legitimately
returns `null` for projects that aren't registered as Jakarta EE web modules —
free-form projects, Ant Java projects that happen to contain `.jsp` files, GWT
projects with a `webapp/` directory, or `.jsp` files opened standalone from the
Favorites window.
This is a regression introduced by #8976 (*Enable parsing of JSP 3.0
(Jakarta) based sources*) in NetBeans 29.
### Language / Project Type / NetBeans Component
JSP / `enterprise/web.jspparser`
### How to reproduce
1. Have any project containing `.jsp` files where
`WebModule.getJ2eeProfile()` returns `null` (e.g. Ant free-form project, or a
Java/GWT project with `.jsp` files under a webapp folder but no Jakarta EE
profile configured).
2. Double-click a `.jsp` file in the Projects window.
3. The editor tab opens and immediately closes; the NPE above appears in
`messages.log`.
### Did this work correctly in an earlier version?
Yes — works correctly in Apache NetBeans 28.
### Operating System
Linux — Ubuntu MATE 24.04 (kernel 6.x, amd64)
### JDK
<!-- bitte deine JDK-Version eintragen, z. B. Temurin 21.0.5 -->
### Apache NetBeans packaging
<!-- z. B. Apache binary zip / Codelerity .deb / snap -->
### Anything else
Likely fix: null-guard the `WebModule.getJ2eeProfile()` call in
`JspParserImpl.createParseProxy` (and `getParseProxy`), falling back to the JSP
2.x parsing path when no profile is set. As a current workaround, disabling the
`org.netbeans.modules.web.jspparser` module (Tools → Plugins → Installed) lets
`.jsp` files open again, but obviously without JSP parsing/completion.
cc @matthiasblaesing — author of #8976.
### Are you willing to submit a pull request?
<!-- ja/nein nach Wunsch -->
### Language / Project Type / NetBeans Component
_No response_
### How to reproduce
Simply open .jsp file with active "Java Web and EE".
### Did this work correctly in an earlier version?
Apache NetBeans 28
### Operating System
Ubuntu
### JDK
JDBK 25
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists