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
{{ message }}
Repository navigation
Rename refactor fails 1/2 on Swing event handlers #9671
The rename refactor of Swing controls fails after it had renamed the references to the method but before it renamed the method itself.
This leaves the undo buffer empty. The only recovery is to be done by manually editing the references or from source control because Netbeans does not offer any other method of renaming event handlers.
Language / Project Type / NetBeans Component
Java
How to reproduce
Create a Java project
Add a Swing form
Add an event handler
Try to refactor rename it
getting a NPE while trying to rename a JButton form designer component from within the code editor (no event listeners added). It does work from the Properties window. Tbh I didn't even know that was an option since the generated code is in guarded sections - but the rename action did seem to work until NB 29.
SEVERE [org.openide.util.Exceptions]
java.lang.NullPointerException: Cannot invoke "org.netbeans.modules.refactoring.api.AbstractRefactoring.getGBHandlers()" because "refactoring" is null
at org.netbeans.modules.refactoring.api.AccessorImpl.getGBHandlers(AccessorImpl.java:39)
at org.netbeans.modules.refactoring.spi.RefactoringElementsBag.add(RefactoringElementsBag.java:93)
at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin.createAndAddElements(JavaRefactoringPlugin.java:345)
at org.netbeans.modules.refactoring.java.spi.JavaRefactoringPlugin.createAndAddElements(JavaRefactoringPlugin.java:356)
at org.netbeans.modules.refactoring.java.plugins.RenameRefactoringPlugin.prepare(RenameRefactoringPlugin.java:613)
[catch] at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare2(AbstractRefactoring.java:417)
at org.netbeans.modules.refactoring.api.AbstractRefactoring.pluginsPrepare(AbstractRefactoring.java:401)
at org.netbeans.modules.refactoring.api.AbstractRefactoring.prepare(AbstractRefactoring.java:212)
at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$Prepare.run(ParametersPanel.java:1063)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1370)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1981)
Activity
mbien commentedon Oct 6, 2026
seems to be a regression since NB 29.
getting a NPE while trying to rename a JButton form designer component from within the code editor (no event listeners added). It does work from the Properties window. Tbh I didn't even know that was an option since the generated code is in guarded sections - but the rename action did seem to work until NB 29.
likely since #9069