Community
Participate
Working Groups
build 20020228 When I create a package with a very long name in an already fairly deep (from a file system point of view) project location I get an internal error with the attached stack trace. When I create the same folder at the same point in the file system using the Windows Explorer, the folder name is automatically truncated. It seems that the new package name exceeds the NT limit on path length. Instead of the internal error I would expect an error message telling me that the package could not be created. In addition, a package was created in the workbench despite the error and with a truncated name. The corresponding folder does not exist in the file system and when I refresh from local on the project the package does not disappear.
Created attachment 413 [details] Stack trace
Not sure whether the exception is swallowed by Core or JDT Core. Moving one level down to JDT Core for comment.
Olivier - can you please investigate if jdtcore is catching this exception ?
When you create a long package name, are you creating all subparts at once or you create first the first part, then the second part and so on. All the subparts that could be created are created, and I don't see what is wrong with this. I'll try to find out why we do put something in the log. Could you please let me know what you expect.
My test case is to create a package with the following name: kr.thisisaverylongtestpackagetotestbug2079.thisisaverylongtestpackagetotestbug207.thisisaverylongtestpackagetotestbug20.thisisaverylongtestpackagetotestbug2.thisisaverylongtestpackagetotestbug3.thisisaverylongtestpackagetotestbug4 Is this what you did?
That's basically what I did. I typed in the whole long name in the new package wizard. It did create the truncated package in Eclipse but not the corresponding folders in the file system - I suspect that's where the internal error comes from. It should either silently create the truncated package in *both* Eclipse and the file system. Better yet, when I type in the name it should warn me that the name is too long. That way I would know to choose a different/shorter name. Note that the project folder was already pretty deep in the file system.
The limit seems to be around 256 characters. When I did my test, I could see that the CreatePackageFragmentOperation was stopped with a JavaModelException reporting the CoreException which is that a folder was not created. Then this JavaModelException is propagated to the UI and at one point it ends up to write the stack trace into the .log file. I'll try to investigate more.
Note that the directory length limit may vary on platforms. I thought it was more like 512 bytes on NT. Are you running NT?
I am running Windows2000 and the limit seems to be around 256.
The JDT/Core operation returns a JavaModelException containing the underlying CoreException. So I don't see anything wrong in the JDT/Core code. I am suspecting the JDT/UI wizard not to handle properly the JavaModelException thrown by JDT/Core. Move to JDT/UI for comments.
The wizard correctly catches the exception, and displays an error dialog. (and also prints to the log). What is a problem is that the error message should not contain expressions like 'CoreException'. The error dialog shows the message received by coreException.getStatus It is the JavaModelStatus.getMessage that includes the word 'CoreException'. Move to jcore
Olivier - We should remove 'CoreException' from the error message.
Why do we want to remove 'CoreException' from the error message? It is a CoreException. This is explicitly set in the JavaModelStatus.getMessage().
Maybe JDT UI should display a user friendly error message instead of presenting the core exception to the user?
I can remove the 'Core Exception : ' from the error message, but in this case I found the dialog too small anyway. The message I got is useless. I don't see the end of the package name.
The "CodeException: " has been removed from the error message. Fixed and released in HEAD.