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 208919

Summary: CCE in ParsingLayerCacheManager.startElement if file and folder collide
Product: platform Reporter: Jesse Glick <jglick>
Component: Module SystemAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Linux   
URL: http://statistics.netbeans.org/exceptions/messageslog?id=562500
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 214254    
Attachments: Test case
automatically converts files to folders

Description Jesse Glick 2012-02-27 17:40:06 UTC
See exception report URL (miscategorized).

While parsing jar:file:/space/src/nb/main/nbbuild/netbeans/ide/modules/org-netbeans-modules-projectui.jar!/META-INF/generated-layer.xml
Caused: java.lang.ClassCastException: Stack: [MemFolder[null], MemFolder[Templates], MemFolder[Other], MemFolder[Folder]]
	at org.netbeans.core.startup.layers.ParsingLayerCacheManager.startElement(ParsingLayerCacheManager.java:226)

This after trying to override Templates/Other/Folder/ in favorites module (a folder) with a file of the same name in projectui.

Also caused an NPE later in LayerCacheManager$1Updater.flushCaches.
Comment 1 Jaroslav Tulach 2012-04-06 13:23:23 UTC
ergonomics#52e1b7cdc80b - improving the exception text
Comment 2 Jesse Glick 2012-04-09 23:32:06 UTC
Created attachment 118025 [details]
Test case
Comment 3 Jesse Glick 2012-04-09 23:32:25 UTC
Easily reproduced with the attached minimal test case.
Comment 4 Jaroslav Tulach 2012-04-18 15:11:01 UTC
OK, so the problem is that folder is defined first and then another module defines file of the same name. What should happen in this situation?
Comment 5 Jesse Glick 2012-04-18 15:37:39 UTC
Well in the originally reported exception I was trying to use the 'weight' attribute to make the (empty) file "win". This is presumably a rare situation, so it might be asking too much for 'weight' to be honored there - I managed to do what I needed by masking the folder, then creating a file with a different name. If MultiFileSystem has a well-defined way of handling this situation, I guess BinaryFS should copy it. Or it could log a graceful warning and skip one or both of the entries.
Comment 6 Quality Engineering 2012-04-19 10:01:57 UTC
Integrated into 'main-golden', will be available in build *201204190400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/52e1b7cdc80b
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #208919: More information about the instanceof check
Comment 7 Quality Engineering 2012-04-26 10:33:01 UTC
Integrated into 'main-golden', will be available in build *201204260400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/5e896460d1c7
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #208919: Test to confirm behavior
Comment 8 Milos Kleint 2012-10-01 14:30:42 UTC
-> P3, another P3 depends on this
Comment 9 Jaroslav Tulach 2012-12-17 15:48:05 UTC
Created attachment 129465 [details]
automatically converts files to folders

ContentProviderTest and RepositoryTest in openide.filesystems seem to be failing however.
Comment 10 Jaroslav Tulach 2013-12-20 10:56:00 UTC
ergonomics#2fdbbb52075c
Comment 11 Quality Engineering 2014-01-09 02:55:33 UTC
Integrated into 'main-silver', will be available in build *201401090002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2fdbbb52075c
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #208919: Survive collisions between two modules defining the same resource as file and as a folder