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.
Using EE kit 020124 It shouldn't be allowed to create a package name that contains a space. To reproduce: 1) Mount a new filesystem 2) Create a new package, "MyPackage" 3) Rename the package to "My Package" If sources exist in the package then a dialog opens with ... Package "MyPackage" was renamed to "My Package". Do you want to change package declarations in Java sources inside the package? Result: "MyPackage" could be renamed to "My Package" It is illegal to have a package name that contains a space.
It is not possible to prevent from renaming folders to the names with spaces. I would suggest to change the dialog message when invalid Java package name is used for folder name. The warning could say something like: "The new name of package is not a valid Java package name. .... ". As the implementation of this dialog is in Java module, I am changing the component: core -> java.
I would expect NB to recognize that I'm renaming a package, not a folder. Regardless, I think renaming a folder to a name that contains a space is a bad thing, it doesn't make any sense.
The reason why it's bad is that I don't know of any Java programs that could compile. For a Web Module, if this type of folder is created in the WEB-INF/Classes directory then the Web module cannot compile. If any Java program resides in this type of package in the name then it can't compile either.
I disagree that renaming a folder to have a space in the name is pointless. Under well-behaved OSes, a filename has no restriction on characters it can contain (except the path separator and sometimes null char - terminator). On Windows, giving spaced names is convenient for users, since folder names can be descriptive. The current IDE's design does not permit checking for valid package name, preventing the rename operation. I will implement Petr's suggestion to issue a warning afterwards. Note that there can be free-named folders (not packages) underneath the package structure - resources can be here, since ClassLoaders survive spaces in resource names, but classes can't be in such folders (since they are not packages).
Fixed in trunk - a warning is issued after the package name has been changed to a non-identifier. /cvs/java/src/org/netbeans/modules/java/PackageHandler.java,v <-- PackageHandler.java new revision: 1.2; previous revision: 1.1
VERIFIED
Resolved for 3.4.x or earlier, no new info since then -> closing.