Bug 10544 - Internal error creating long package name
Summary: Internal error creating long package name
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-28 17:39 EST by Knut Radloff CLA
Modified: 2002-03-25 11:30 EST (History)
0 users

See Also:


Attachments
Stack trace (12.60 KB, text/plain)
2002-02-28 17:41 EST, Knut Radloff CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Radloff CLA 2002-02-28 17:39:33 EST
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.
Comment 1 Knut Radloff CLA 2002-02-28 17:41:41 EST
Created attachment 413 [details]
Stack trace
Comment 2 Erich Gamma CLA 2002-03-03 18:51:06 EST
Not sure whether the exception is swallowed by Core or JDT Core. Moving one 
level down to JDT Core for comment.
Comment 3 Philipe Mulet CLA 2002-03-05 17:08:15 EST
Olivier - can you please investigate if jdtcore is catching this exception ?
Comment 4 Olivier Thomann CLA 2002-03-07 13:19:51 EST
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.
Comment 5 Olivier Thomann CLA 2002-03-07 13:20:46 EST
My test case is to create a package with the following 
name:
kr.thisisaverylongtestpackagetotestbug2079.thisisaverylongtestpackagetotestbug207.thisisaverylongtestpackagetotestbug20.thisisaverylongtestpackagetotestbug2.thisisaverylongtestpackagetotestbug3.thisisaverylongtestpackagetotestbug4

Is 
this what you did?
Comment 6 Knut Radloff CLA 2002-03-07 13:46:11 EST
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.
Comment 7 Olivier Thomann CLA 2002-03-07 13:52:01 EST
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.
Comment 8 Knut Radloff CLA 2002-03-07 14:07:24 EST
Note that the directory length limit may vary on platforms. I thought it was 
more like 512 bytes on NT. Are you running NT?
Comment 9 Olivier Thomann CLA 2002-03-07 14:09:17 EST
I am running Windows2000 and the limit seems to be around 256.
Comment 10 Olivier Thomann CLA 2002-03-11 13:57:20 EST
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.
Comment 11 Martin Aeschlimann CLA 2002-03-21 03:55:34 EST
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
Comment 12 Philipe Mulet CLA 2002-03-21 10:54:26 EST
Olivier - We should remove 'CoreException' from the error message.
Comment 13 Olivier Thomann CLA 2002-03-21 11:38:56 EST
Why do we want to remove 'CoreException' from the error message? It is a CoreException. This is 
explicitly set in the JavaModelStatus.getMessage().
Comment 14 Knut Radloff CLA 2002-03-21 11:59:00 EST
Maybe JDT UI should display a user friendly error message instead of presenting 
the core exception to the user?
Comment 15 Olivier Thomann CLA 2002-03-21 12:03:13 EST
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.
Comment 16 Olivier Thomann CLA 2002-03-25 11:30:57 EST
The "CodeException: " has been removed from the error message.
Fixed and released in HEAD.