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 7895 - Executing paste on a java fields node containing a field with the same name results in an exception
Summary: Executing paste on a java fields node containing a field with the same name r...
Status: CLOSED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P3 normal (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-10-12 19:49 UTC by Chris Webster
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Webster 2000-10-12 19:49:31 UTC
The exception below is generated when the paste operation executes. If the
operation will fail, A notify descriptor describing the error would be better
than the stack trace. However, this behavior is inconsistent to what is being
done when a java node itself is being copied to a package that already contains
a java class with the same name. This operation mutates the class name to find a
unique name. Similar behavior would be appropriate in pasting of fields and
methods.


Thu Oct 12 11:43:02 PDT 2000org.openide.src.SourceException: A field named
newField already exists in the class test.
org.openide.src.SourceException: A field named newField already exists in the
class test.
        at org.openide.src.Element.throwSourceException(Element.java:183)
        at org.openide.src.ClassElement.throwAddException(ClassElement.java:719)
        at org.openide.src.ClassElement.addField(ClassElement.java:307)
        at
org.openide.src.nodes.ClassElementNode$3.run(ClassElementNode.java:193)
        at
org.openide.src.nodes.SourceEditSupport$2.run(SourceEditSupport.java:254)
        at
org.netbeans.editor.BaseDocument.runAtomicAsUser(BaseDocument.java:709)
        at
org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:242)
        at org.openide.text.NbDocument.runAtomicAsUser(NbDocument.java:299)
        at
org.netbeans.modules.java.SourceElementImpl.runAtomicAsUser(SourceElementImpl.java:568)
        at org.openide.src.SourceElement.runAtomicAsUser(SourceElement.java:287)
        at
org.openide.src.nodes.SourceEditSupport.invokeAtomicAsUser(SourceEditSupport.java:261)
        at
org.openide.src.nodes.ClassElementNode.pasteElement(ClassElementNode.java:185)
        at
org.openide.src.nodes.ClassElementNode$2.paste(ClassElementNode.java:164)
        at org.openide.actions.PasteAction.performAction(PasteAction.java:109)
        at
org.openide.actions.PasteAction$ActSubMenuModel.performActionAt(PasteAction.java:195)
        at
org.openide.awt.Actions$SubMenuBridge$ISubActionListener.actionPerformed(Actions.java:503)
        at org.openide.awt.Actions$SubMenu.doClick(Actions.java:773)
        at
javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:886)
        at java.awt.Component.processMouseEvent(Component.java:3715)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1165)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1214)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2452)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2217)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2126)
        at java.awt.Container.dispatchEventImpl(Container.java:1201)
        at java.awt.Window.dispatchEventImpl(Window.java:912)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:333)
        at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
java.io.IOException: A field named newField already exists in the class test.
        at
org.openide.src.nodes.SourceEditSupport.invokeAtomicAsUser(SourceEditSupport.java:270)
        at
org.openide.src.nodes.ClassElementNode.pasteElement(ClassElementNode.java:185)
        at
org.openide.src.nodes.ClassElementNode$2.paste(ClassElementNode.java:164)
        at org.openide.actions.PasteAction.performAction(PasteAction.java:109)
        at
org.openide.actions.PasteAction$ActSubMenuModel.performActionAt(PasteAction.java:195)
        at
org.openide.awt.Actions$SubMenuBridge$ISubActionListener.actionPerformed(Actions.java:503)
        at org.openide.awt.Actions$SubMenu.doClick(Actions.java:773)
        at
javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:886)
        at java.awt.Component.processMouseEvent(Component.java:3715)
        at java.awt.Component.processEvent(Component.java:3544)
        at java.awt.Container.processEvent(Container.java:1165)
        at java.awt.Component.dispatchEventImpl(Component.java:2593)
        at java.awt.Container.dispatchEventImpl(Container.java:1214)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2452)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2217)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2126)
        at java.awt.Container.dispatchEventImpl(Container.java:1201)
        at java.awt.Window.dispatchEventImpl(Window.java:912)
        at java.awt.Component.dispatchEvent(Component.java:2497)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:333)
        at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
bling%
Comment 1 Svata Dedic 2000-10-30 10:58:59 UTC
The dialog title will probably still contain "Exception" string - it's the job
of ErrorManager to notify user about various errors. However the exception will
not be displayed as unexpected.
Comment 2 Jan Becicka 2000-10-30 15:51:59 UTC
[1133] There is *NO* dialog invoked now, if existing field/method is pasted into
class.
Comment 3 Svata Dedic 2000-10-31 15:41:59 UTC
1034 - tested and it works OK. Please describe a testcase if it does not work
for you.
Comment 4 Quality Engineering 2003-07-01 13:12:14 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 5 Quality Engineering 2003-07-01 13:17:04 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.