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 52161 - Getting Children assertions for immutable keys
Summary: Getting Children assertions for immutable keys
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Petr Nejedly
URL:
Keywords: RANDOM, THREAD
Depends on:
Blocks:
 
Reported: 2004-12-07 14:47 UTC by _ pkuzel
Modified: 2008-12-23 00:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The assert trace (2.19 KB, text/plain)
2004-12-07 14:48 UTC, _ pkuzel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ pkuzel 2004-12-07 14:47:26 UTC
RANDOM and I suspect that assert logic or message
is wrong for particular key impl:

    /**
     * FileKey is more robust that plain
FileObject, it's immutable.
     */
    private static class FileKey {
        private final String name;
        private final boolean folder;

        FileKey(FileObject fo) {
            name = fo.getNameExt();
            folder = fo.isFolder();
        }

        public String getNameExt() {
            return name;
        }

        public boolean isFolder() {
            return folder;
        }

        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof FileKey)) return false;

            final FileKey fileKey = (FileKey) o;

            if (folder != fileKey.folder) return
false;
            if (name != null ?
!name.equals(fileKey.name) : fileKey.name != null)
return false;

            return true;
        }

        public int hashCode() {
            int result;
            result = (name != null ?
name.hashCode() : 0);
            result = 29 * result + (folder ? 1 : 0);
            return result;
        }
    }
Comment 1 _ pkuzel 2004-12-07 14:48:01 UTC
Created attachment 19176 [details]
The assert trace
Comment 2 Petr Nejedly 2004-12-08 11:08:25 UTC
Strange. The assert logic is OK, but the threading have to be broken
somehow. The map and entries have to get out of sync somehow...
Comment 3 Petr Nejedly 2005-03-15 13:14:59 UTC
Are you still getting those assertions after several fixes in nodes/explorer
threading?
Comment 4 Petr Nejedly 2005-04-08 14:12:26 UTC
Was probably caused by the FileKey equals() clash for more fileobjects for the
same path (valid vs. more invalid FOs).