My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 85: TMAPI NameImpl produces NPEs
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  h.niederhausen
Closed:  Jul 20
Cc:  lars.heuer
Type-Defect
Priority-Medium
Component-Engine
Release5.0.1


Sign in to add a comment
 
Reported by lars.heuer, Jul 20, 2009
     [java] 1) testName(org.tmapi.core.TestScoped)
java.lang.NullPointerException
     [java]     at net.ontopia.topicmaps.impl.tmapi2.NameImpl.removeTheme
(NameImpl.java:246)
     [java]     at org.tmapi.core.TestScoped._testScoped(TestScoped.java:
49)
     [java]     at org.tmapi.core.TestScoped.testName(TestScoped.java:84)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
     [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
     [java]     at net.ontopia.test.TestRunner.run(TestRunner.java:125)
     [java]     at net.ontopia.test.TestRunner.main(TestRunner.java:60)
     [java] 2) testUsedAsNameTheme
(org.tmapi.core.TestTopicRemovableConstraint)
java.lang.NullPointerException
     [java]     at net.ontopia.topicmaps.impl.tmapi2.NameImpl.removeTheme
(NameImpl.java:246)
     [java]     at org.tmapi.core.TestTopicRemovableConstraint._testScoped
(TestTopicRemovableConstraint.java:75)
     [java]     at
org.tmapi.core.TestTopicRemovableConstraint.testUsedAsNameTheme
(TestTopicRemovableConstraint.java:179)
Comment 1 by lars.heuer, Jul 20, 2009
This is caused since the wrappedVariants is initialized with null. 

This should fix it:

  public void removeTheme(Topic theme) {
    super.removeTheme(theme);
    for (Variant v : getVariants()) {
      if (((VariantImpl) v).getExplicitScope().contains(theme))
        v.addTheme(theme);
    }
  }


I'd do it but I don't understand what the code does. If a theme is removed from a
name, that theme is added to the variant iff it is in getExplicitScope()?!?
Why doesn't the variant return the union of the explicit scope and the 'other' scope?!?
Commenting the code would help. :)

Comment 2 by h.niederhausen, Jul 20, 2009
I'm working on it. Including some comments ;)
Comment 3 by h.niederhausen, Jul 20, 2009
This issue was closed by r345.
Status: Fixed
Comment 4 by larsga, Sep 01, 2009
(No comment was entered for this change.)
Labels: Release5.0.1
Sign in to add a comment

Hosted by Google Code