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 28296 - NullPointerException when clearing reference
Summary: NullPointerException when clearing reference
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P4 blocker (vote)
Assignee: Martin Matula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-26 07:08 UTC by _ briansmith
Modified: 2010-09-23 09:14 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 _ briansmith 2002-10-26 07:08:47 UTC
Run the following under internal execution inside
NetBeans. You will get a NullPointerException like
the one that follows. The problem is that
AEIndexSetWrapper.clear() is calling
IndexSetWrapper.wrap() with a null argument. This
causes IndexSetWrapper.wrap() to return null.
Then, this null result is given to
AEIndexSetWrapper.remove() and then also given to
AssocEndIndexSet.checkType(). checkType throws the
NullPointerException explicitly when it finds its
argument is null.

Note that this seems to only happen when the whole
extent is deleted. If you change the
pkgA.refDelete() to p.refDelete() then there is no
NullPointerException.

This affects the <mof> Ant task I wrote but I was
able to work around it by simply doing the
.clear() before the .refDelete() of the extent.

import org.netbeans.api.mdr.*;
import javax.jmi.model.*;

public class EmptyReferenceTest {
    public static void main(String [] s) throws
CreationFailedException {
        MDRepository repository =
MDRManager.getDefault().getDefaultRepository();
        ModelPackage pkgA = (ModelPackage)
repository.createExtent("A");
        ModelPackage pkgB = (ModelPackage)
repository.createExtent("B");
        MofPackage p =
pkgA.getMofPackage().createMofPackage();
        Constraint c =
pkgB.getConstraint().createConstraint();
        c.getConstrainedElements().add(p);
        //p.refDelete();
        pkgA.refDelete();
        c.getConstrainedElements().clear();
    }
}

=>

java.lang.NullPointerException
        at
org.netbeans.mdr.storagemodel.AssocEndIndexSet.checkType(AssocEndIndexSet.java:73)
        at
org.netbeans.mdr.handlers.AEIndexSetWrapper.remove(AEIndexSetWrapper.java:111)
        at
org.netbeans.mdr.handlers.AEIndexSetWrapper.clear(AEIndexSetWrapper.java:51)
        at
EmptyReferenceTest.main(EmptyReferenceTest.java:13)
        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at
java.lang.reflect.Method.invoke(Method.java:324)
        at
org.openide.execution.ThreadExecutor.executeClass(ThreadExecutor.java:117)
        at
org.openide.execution.ThreadExecutor$TERunnable.run(ThreadExecutor.java:184)
        at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:118)
Comment 1 Martin Matula 2003-01-06 15:04:37 UTC
This is caused by a bug in refDelete for whole extent.
RefPackage.refDelete should delete links from all external extents as
RefObject.refDelete does it.
Comment 2 Martin Matula 2005-10-14 07:33:50 UTC
This only applies to inter-extent links. Lowering priority.
Comment 3 David Strupl 2010-09-23 09:14:01 UTC
I am closing all reports in category Java/Unsupported as wontfix. These should
be dead issues --- if the reported cases are against some live part of the
NetBeans IDE please reopen and we can discuss to which category they belong.