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 227190

Summary: java.lang.NullPointerException from Java Text Copy Paste Module
Product: updatecenters Reporter: ent38 <ent38>
Component: PluginportalAssignee: _ wadechandler <wadechandler>
Status: NEW ---    
Severity: normal CC: wadechandler
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description ent38 2013-03-07 23:16:36 UTC
NPE on some operations

http://plugins.netbeans.org/plugin/2748
Comment 1 ent38 2013-03-07 23:20:56 UTC
I get a NPE on some operations:

java.lang.NullPointerException
	at org.netbeans.modules.javatextcopypaste.CopyUtils.copyJavaText(CopyUtils.java:36)
	at org.netbeans.modules.javatextcopypaste.CopyAsTextWithNewlinesAndNoJavaNewlines.performAction(CopyAsTextWithNewlinesAndNoJavaNewlines.java:24)
	at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:586)
	at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
	at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
	at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
	at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:583)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
	at java.awt.Component.processMouseEvent(Component.java:6297)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
	at java.awt.Component.processEvent(Component.java:6062)
	at java.awt.Container.processEvent(Container.java:2039)
	at java.awt.Component.dispatchEventImpl(Component.java:4660)
	at java.awt.Container.dispatchEventImpl(Container.java:2097)
	at java.awt.Component.dispatchEvent(Component.java:4488)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
	at java.awt.Container.dispatchEventImpl(Container.java:2083)
	at java.awt.Window.dispatchEventImpl(Window.java:2489)
	at java.awt.Component.dispatchEvent(Component.java:4488)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:674)
	at java.awt.EventQueue.access$400(EventQueue.java:81)
	at java.awt.EventQueue$2.run(EventQueue.java:633)
	at java.awt.EventQueue$2.run(EventQueue.java:631)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$3.run(EventQueue.java:647)
	at java.awt.EventQueue$3.run(EventQueue.java:645)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:644)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
[catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


To reproduce this bug case :
- Open a Java file and select the entire content
- make a regular copy (Ctrl + C)
- put the cursor to the end of the file
- use the "Copy as text - keep all escaped newlines and no java newlines"
- an NPE is thrown


Verified with NB 7.3 on Windows 7 32-bit, with JDK6u43 and JDK7u17. Clean installation and profile.

Could you take a look at this ? Thx.
Comment 2 Jiri Kovalsky 2013-03-11 14:30:06 UTC
Thanks Jonathan for finding the issue and reporting it to Bugzilla. However, I must ask you to change your NoGo verdict to Go if you didn't find any violations of substantial plugin requirements described in the Plugin Portal Quality Criteria [1] document. Thanks for your understanding.

[1] http://wiki.netbeans.org/PluginPortalQualityCriteria
Comment 3 _ wadechandler 2013-03-11 14:54:00 UTC
Thank you very much for finding the bug. It is related to using the copy methods when no selection is made. For now, most users will not do that under normal conditions, but I will definitely fix this, and will republish as soon as I can. In the mean time, it is still very usable for those who have been using the plugin. This issue seems to have been hanging around for years now with nobody reporting it or finding it. You therefore are a very good and thorough tester :-). But yes, I will fix that issue as soon as I can, and if you could go ahead and give it a go for now, it will still be useful to those who use it, as it doesn't crash the IDE, mangle any data, but gives an error message when that happens. If the user selects data again, then it will work as normal during the cases it is meant to be used.
Comment 4 ent38 2013-03-11 17:32:17 UTC
Oops, sorry for the NoGo vote; it was a bit extreme :p
Corrected the vote.
Comment 5 Jiri Kovalsky 2013-03-12 08:49:38 UTC
No problem, changing description accordingly. Thank you guys.