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 49814

Summary: file templates don't handle illegal characters
Product: projects Reporter: Rich Unger <richunger>
Component: Generic Projects UIAssignee: Jiri Rechtacek <jrechtacek>
Status: CLOSED FIXED    
Severity: blocker    
Priority: P4    
Version: 4.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 41535    

Description Rich Unger 2004-10-01 18:33:56 UTC
When creating a new file, illegal characters (such
as '*') are allowed by the text field's Document,
leading to an IOException when file creation is
attempted.

The typing of such characaters should be prevented
by applying a javax.swing.text.Document to the
text field, and overriding insertString().

 = = = = = = = = = =
Annotation: The filename, directory name, or
volume label syntax is incorrect
java.io.IOException: The filename, directory name,
or volume label syntax is incorrect
        at
java.io.WinNTFileSystem.createFileExclusively(Native
Method)
        at java.io.File.createNewFile(File.java:828)
        at
org.openide.filesystems.LocalFileSystem.createData(LocalFileSystem.java:204)
        at
org.openide.filesystems.LocalFileSystem$Impl.createData(LocalFileSystem.java:463)
        at
org.openide.filesystems.AbstractFileObject.createData(AbstractFileObject.java:381)
        at
org.netbeans.modules.masterfs.MasterFileObject$AtomicAction.createDataExt(MasterFileObject.java:970)
        at
org.netbeans.modules.masterfs.MasterFileObject$AtomicAction.run(MasterFileObject.java:912)
        at
org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:89)
        at
org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:432)
        at
org.netbeans.modules.masterfs.MasterFileObject$AtomicAction.createData(MasterFileObject.java:862)
        at
org.netbeans.modules.masterfs.MasterFileObject.createData(MasterFileObject.java:352)
        at
org.openide.filesystems.FileUtil.copyFileImpl(FileUtil.java:76)
        at
org.openide.filesystems.FileObject.copy(FileObject.java:78)
        at
org.openide.filesystems.MultiFileObject.copy(MultiFileObject.java:1118)
        at
org.openide.filesystems.MultiFileObject.copy(MultiFileObject.java:1118)
        at
org.openide.loaders.FileEntry.createFromTemplate(FileEntry.java:119)
        at
org.openide.loaders.MultiDataObject.handleCreateFromTemplate(MultiDataObject.java:610)
        at
org.openide.loaders.DataObject$7.run(DataObject.java:703)
        at
org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:191)
        at
org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:89)
        at
org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:432)
        at
org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:203)
        at
org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:760)
        at
org.openide.loaders.DataObject.createFromTemplate(DataObject.java:701)
        at
org.openide.loaders.TemplateWizard$DefaultIterator.instantiate(TemplateWizard.java:833)
        at
org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:549)
        at
org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:465)
        at
org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:351)
[catch] at
org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:98)
        at
org.netbeans.modules.project.ui.actions.NewFile.actionPerformed(NewFile.java:75)
        at
org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:72)
        at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
        at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
        at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at
javax.swing.AbstractButton.doClick(AbstractButton.java:289)
        at
javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
        at
javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
        at
java.awt.Component.processMouseEvent(Component.java:5100)
        at
java.awt.Component.processEvent(Component.java:4897)
        at
java.awt.Container.processEvent(Container.java:1569)
        at
java.awt.Component.dispatchEventImpl(Component.java:3615)
        at
java.awt.Container.dispatchEventImpl(Container.java:1627)
        at
java.awt.Component.dispatchEvent(Component.java:3477)
        at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
        at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
        at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
        at
java.awt.Container.dispatchEventImpl(Container.java:1613)
        at
java.awt.Container.dispatchEventImpl(Container.java:1613)
        at
java.awt.Window.dispatchEventImpl(Window.java:1606)
        at
java.awt.Component.dispatchEvent(Component.java:3477)
        at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
        at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Comment 1 Jesse Glick 2004-10-03 20:41:17 UTC
I'm sure this is a duplicate of something, but I can't find it right
now...
Comment 2 Milan Kubec 2004-10-04 08:40:21 UTC
Allowing to create project name that ends up with IOE deserves higher
prio than P4.
Comment 3 Jesse Glick 2004-10-04 16:49:08 UTC
I think P4 was correct. This was about a file wizard, not a project
wizard. If the operating system does not support a class of file
names, the user should not be trying to make one; the IDE ought to
help remind the user of this earlier.
Comment 4 Jiri Rechtacek 2004-10-12 15:03:19 UTC
Note: After implementation issue 49332, the wizard can throw
IOException if new file creation fails, notify user and allow an user
correct input values.
Comment 5 Jiri Rechtacek 2004-10-14 12:01:07 UTC
Resolving issue 49332 fixes this issue enough, closed as fixed.
Comment 6 Marian Mirilovic 2005-12-20 15:46:54 UTC
This issue was solved long time ago. Because nobody has reopened it neither
added comments, we are verifying/closing it now. 
If you are still able to reproduce the problem, please reopen. Thanks in advance.