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 40108

Summary: Exception occurs when pasting class to the package
Product: java Reporter: Jiri Mzourek <jmzourek>
Component: UnsupportedAssignee: Jan Pokorsky <jpokorsky>
Status: RESOLVED INVALID    
Severity: blocker CC: pgebauer
Priority: P3 Keywords: SIMPLEFIX
Version: 3.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jiri Mzourek 2004-02-14 17:14:11 UTC
Steps to reproduce:
  - create a package;
  - create java class in the package;
  - select java class node and expand it;
  - select child node;
  - select copy from context menu;
  - select package node and paste class there;
  - an exception occurs:
Annotation: File Class.java already exists in E:\b_10.
java.io.SyncFailedException: File Class.java
already exists in E:\b_10.
        at
org.openide.filesystems.LocalFileSystem.createData(LocalFileSystem.java:211)
        at
org.openide.filesystems.LocalFileSystem$Impl.createData(LocalFileSystem.java:458)
        at
org.openide.filesystems.AbstractFileObject.createData(AbstractFileObject.java:388)
        at
org.openide.src.nodes.SourceEditSupport.createJavaFile(SourceEditSupport.java:397)
        at
org.openide.src.nodes.SourceEditSupport$PackagePaste$Type.paste(SourceEditSupport.java:495)
        at
org.openide.actions.PasteAction.executePasteType(PasteAction.java:183)
        at
org.openide.actions.PasteAction.access$100(PasteAction.java:60)
        at
org.openide.actions.PasteAction$ActionPT.actionPerformed(PasteAction.java:777)
        at
org.netbeans.core.ModuleActions$1.run(ModuleActions.java:97)
        at org.openide.util.Task.run(Task.java:136)
        at
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:328)
[catch] at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:670)
Comment 1 Jiri Mzourek 2004-02-15 16:30:27 UTC
Since this bug is there for a long time and has been discovered just
recently, I would consider this use case as an edge case. 
I would propose this "correct" behavior, if possible: I would keep it
consistent with the behavior on files level -- automatically add
numbered suffix (like _1, _2, etc.). 
Comment 2 Jan Pokorsky 2004-03-03 15:28:10 UTC
Yeah, there is a typo in SourceEditSupport.createJavaFile. The new
name is generated but the original one is used in spite of that.

If you like to see this fixed in nb 3.6 raise the priority to P2.
Otherwise it will be fixed in the next release.
Comment 3 Jan Becicka 2004-07-13 15:45:57 UTC
Cannot reproduce in promo-D