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 72320 - New File Wizard doesn't work well with files without extensions.
Summary: New File Wizard doesn't work well with files without extensions.
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on: 72318
Blocks:
  Show dependency tree
 
Reported: 2006-02-06 21:43 UTC by Thomas Preisler
Modified: 2007-11-01 14:05 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 Thomas Preisler 2006-02-06 21:43:27 UTC
when creating a file with the New File Wizard, the wizard checks whether the
file already exists on disk and doesn't allow the user to continue if it does.
This check fails for files without an extension, our makefiles for instance. The
bug is probably in NB5.0 (see issue
http://www.netbeans.org/issues/show_bug.cgi?id=72318), but we may have to come
with a work-around since cnd has to work with 5.0.
Comment 1 _ gordonp 2006-05-02 18:43:44 UTC
Removing CND-Preview-2 flag. This isn't a simple fix and isn't worth sliding
the preview for.
Comment 2 _ gordonp 2006-10-17 18:36:24 UTC
Reassigning because I've got too many IZs to fix by FCS.
Comment 3 Jesse Grodnik 2006-11-13 18:45:39 UTC
Downgraded to P3.
Comment 4 Jesse Grodnik 2006-11-13 18:47:31 UTC
Priority changed in error
Comment 5 Alexander Simon 2006-11-14 15:32:54 UTC
It's seems netbeans bug.
File name validation is located in method:
org.netbeans.modules.project.ui.SimpleTargetChooserPanel.isValid():
line 96:
        String errorMessage = ProjectUtilities.canUseFileName
(gui.getTargetGroup().getRootFolder(), gui.getTargetFolder(),
gui.getTargetName(), template.getExt (), isFolder);
Look at method getExt() of org.openide.filesystems.MultiFileObject extends
org.openide.filesystems.AbstractFolder.getExt():
line 111:
        /** period at first position is not considered as extension-separator */
        return ((i <= 1) || (i == name.length())) ? "" : name.substring(i); //
NOI18N
Extension will be empty string or contains nonempty string
Method canUseFileName() expect that extension will be null or nonempty string:
org.netbeans.modules.project.ui.ProjectUtilities.canUseFileName (FileObject
targetFolder, String folderName, String newObjectName, String extension, boolean
allowFileSeparator):
line 312:
if (extension != null) {
     relFileName.append('.');
     relFileName.append(extension);
}
As result file name for make file will be ended ".".
File system returns:
File "Makefile." doesn't exist when "Makefile" exists.
Bug can be reproduced on "Other-Empty file" wizard.
Comment 6 Jesse Grodnik 2006-11-14 19:05:26 UTC
Downgraded to P3
Comment 7 alexandrov 2007-08-15 10:02:55 UTC
Bugfix verified in CND 5.5.1_u1(Build 20070802)
Since 72318 is closed and verified I can also close this bug in CND.
Comment 8 soldatov 2007-11-01 14:05:41 UTC
verified in 200710310000 build