This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 252671

Summary: Unreliable connection to DataObject for custom hints
Product: java Reporter: err <err>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 217602
Attachments: stacktrace

Description err 2015-05-29 02:25:54 UTC
Build: NetBeans IDE 8.0.2 (Build 201411181905)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.40-b25, Java(TM) SE Runtime Environment, 1.8.0_40-b26
OS: Windows 7

User Comments:
err: I had a declarative hint called "astroitem genericize" (the name in the list)
I renamed it to "astroitem-genericize" (note the "-")

Then I couldn't access it from the inspect/tranform dialog anymore to edit it

So I renamed it back, shortly therafter got this exception. The rename did not work. A




Stacktrace: 
java.lang.IllegalArgumentException: Called DataObject.find on null
   at org.openide.loaders.DataObject.find(DataObject.java:555)
   at org.netbeans.modules.java.hints.spiimpl.options.HintsPanel.getDataObject(HintsPanel.java:1349)
   at org.netbeans.modules.java.hints.spiimpl.options.HintsPanel.editScriptButtonActionPerformed(HintsPanel.java:791)
   at org.netbeans.modules.java.hints.spiimpl.options.HintsPanel.access$1100(HintsPanel.java:139)
   at org.netbeans.modules.java.hints.spiimpl.options.HintsPanel$11.actionPerformed(HintsPanel.java:625)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
Comment 1 err 2015-05-29 02:25:56 UTC
Created attachment 153936 [details]
stacktrace
Comment 2 err 2015-05-29 02:29:38 UTC
I closed the IDE, manually renamed the file in /config/rules/, restarted IDE, then it was OK.
Comment 3 Svata Dedic 2015-06-02 10:20:58 UTC
The root cause is that the UI is trying to infer the DataObject from HintMetadata, using the id. However the id may be derived by parsing <!hint> directive. 
In your specific case, the algorithm the UI uses to get the DataObject (so it can rename it) clashes with some disambiguation done by declarative hints infrastructure. Perhaps the parsing should be redesigned as one file may produce several Hints which appear separately in the tree for management. Not good.

In the meantime, please do NOT use "-" in hint names.
Comment 4 Martin Balin 2016-07-07 07:17:27 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss