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 130673 - NPE in AbstractLookup
Summary: NPE in AbstractLookup
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-20 16:43 UTC by Andrei Badea
Modified: 2008-12-22 13:48 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Badea 2008-03-20 16:43:36 UTC
AbstractLookup.matches() dereferences Lookup.Item.getId() without checking for null. Suggest applying:

diff -r 8149e6e1edc1 openide.util/src/org/openide/util/lookup/AbstractLookup.java
--- a/openide.util/src/org/openide/util/lookup/AbstractLookup.java      Mon Mar 17 10:19:49 2008 +0100
+++ b/openide.util/src/org/openide/util/lookup/AbstractLookup.java      Tue Mar 18 20:54:44 2008 +0100
@@ -525,7 +525,7 @@ public class AbstractLookup extends Look
     static boolean matches(Template<?> t, Pair<?> item, boolean deepCheck) {
         String id = t.getId();
 
-        if ((id != null) && !item.getId().equals(id)) {
+        if ((id != null) && !id.equals(item.getId())) {
             return false;
         }
Comment 1 Jaroslav Tulach 2008-03-28 15:03:38 UTC
I do not think this is a bug. You are not allowed to return null from getId(). Anyway, I have fixed it as you 
suggested:


changeset:   75362:7221a9edf0cf
tag:         tip
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Fri Mar 28 15:03:22 2008 +0100
summary:     #130673: Preventing NPE when there is broken Pair impl