apache / apache/netbeans

nullpointer exception trying to save a layout

Open
#3,871 1 comment 0 reactions 0 assignees View on GitHub
FormDesigner Java kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 13

### What happened

Trying to save a form that has nested tabbed panes and some panes inside of those. Error message is generated and Netbeans will not save/exit. Error dump follows:
```

java.lang.NullPointerException
at org.netbeans.modules.form.layoutdesign.LayoutPersistenceManager.saveLayout(LayoutPersistenceManager.java:133)
at org.netbeans.modules.form.layoutdesign.LayoutPersistenceManager.saveContainer(LayoutPersistenceManager.java:113)
at org.netbeans.modules.form.layoutdesign.LayoutModel.saveContainerLayout(LayoutModel.java:1193)
at org.netbeans.modules.form.GandalfPersistenceManager.saveLayout(GandalfPersistenceManager.java:3385)
at org.netbeans.modules.form.GandalfPersistenceManager.saveContainer(GandalfPersistenceManager.java:3339)
at org.netbeans.modules.form.GandalfPersistenceManager.saveAnyComponent(GandalfPersistenceManager.java:3312)
at org.netbeans.modules.form.GandalfPersistenceManager.saveContainer(GandalfPersistenceManager.java:3356)
at org.netbeans.modules.form.GandalfPersistenceManager.saveAnyComponent(GandalfPersistenceManager.java:3312)
at org.netbeans.modules.form.GandalfPersistenceManager.saveContainer(GandalfPersistenceManager.java:3356)
at org.netbeans.modules.form.GandalfPersistenceManager.saveAnyComponent(GandalfPersistenceManager.java:3312)
at org.netbeans.modules.form.GandalfPersistenceManager.saveContainer(GandalfPersistenceManager.java:3356)
at org.netbeans.modules.form.GandalfPersistenceManager.saveAnyComponent(GandalfPersistenceManager.java:3312)
at org.netbeans.modules.form.GandalfPersistenceManager.saveForm(GandalfPersistenceManager.java:3194)
at org.netbeans.modules.form.GandalfPersistenceManager.saveForm(GandalfPersistenceManager.java:3116)
at org.netbeans.modules.form.FormEditor.saveFormData(FormEditor.java:397)
at org.netbeans.modules.nbform.FormEditorSupport.saveDocument(FormEditorSupport.java:476)
at org.netbeans.modules.nbform.FormEditorSupport$16.doSave(FormEditorSupport.java:1611)
at org.netbeans.modules.nbform.FormEditorSupport$16.access$1300(FormEditorSupport.java:1582)
at org.netbeans.modules.nbform.FormEditorSupport$16$1.run(FormEditorSupport.java:1594)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[catch] at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

```

### How to reproduce

I don't know how to do this here. It is a .java file that i am trying to save. Nullpointer exception means maybe I missed something?

### Did this work correctly in an earlier version?

Apache NetBeans 13

### Operating System

Ubunutu 20.04

### JDK

JDK 11

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

Everything I try to save, it fails with the above error message.

### Are you willing to submit a pull request?

Yes

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start at LayoutPersistenceManager.saveLayout on line 133, then follow the saveContainer calls through LayoutModel and GandalfPersistenceManager in the stack trace. Reproduce with the reported form containing nested tabbed panes and identify the state that causes saving to fail. Done means the form saves and exits without the NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.