Summary: | need to render resource folders in JARs | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Martin Aeschlimann <martinae> | ||||||
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | daniel_megert, markus.kell.r | ||||||
Version: | 3.2 | ||||||||
Target Milestone: | 3.3 M6 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 142048, 148657, 151112, 176210 | ||||||||
Attachments: |
|
Description
Martin Aeschlimann
2006-06-28 04:23:21 EDT
+1 to revert the fix for bug 142530 and bug 148657. +1 for a clean fix: Invalid package names in jars should not be package fragments (causes problems such as bug 151112) but some other kind of containers. Created attachment 60183 [details]
Proposed fix
Martin, please let me know if this works for you. If it is ok, I'll ask the PMC for approval on this new API. Note we will have to coordinate the releasing of this patch, since without your changes, we will show only the first level directory in the Package Explorer. I tried the patch and it works. In getParent, shouldn't it also state that it can return a IPackageFragmentRoot. Or is this not possible? (In reply to comment #5) > In getParent, shouldn't it also state that it can return a > IPackageFragmentRoot. Or is this not possible? You're right. Thanks for noticing it. Please see new patch for a fix. Created attachment 60250 [details]
Fix with the possibility of the parent to be an IPackageFragmentRoot
+1 for API change I think JarEntryDirectory#getContents() should throw a CoreException rather than returning an empty stream. IStorage#getContents() already tells that subtypes will refine the exception cases, so IJarEntryResource#getContents() could specify that an exception is thrown if isFile() is false. Anyway, all usage sites of IStorage (esp. 'instanceof IStorage') should be checked for problems like bug 176210 comment 2. Unfortunately existing clients see the non-Java resources as IStorages, which doesn't refine the exception case. Thus they are not prepared for handling the CoreException. Returning an empty stream is not ideal, but I think it is more acceptable to see an empty editor rather than an internal error dialog. > Thus they are not prepared for handling the CoreException. If they're no prepared, then it's a bug in their implementation. From IStorage: /** * [..] * @exception CoreException if the contents of this storage could * not be accessed. See any refinements for more information. */ public InputStream getContents() throws CoreException; E.g. the case from bug 176210 comment 2 is handled correctly because StorageDocumentProvider catches the CoreException and nicely shows the error message in the editor. I find that more informative and less confusing than an empty editor. Although I see Markus point, I'd suggest to keep the behaviour as before (return empty stream). The correct solution would have been to not use IStorage to represent folders. But that's legacy and also not really a major issue. This change will also affect PDE/UI, see bug 176635. Patch released for 3.3M6 in HEAD. *** Bug 22376 has been marked as a duplicate of this bug. *** Verified for 3.3 M6 using v_743. |