TMAPI NameImpl produces NPEs #85

Closed
GoogleCodeExporter opened this Issue Mar 16, 2015 · 4 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter
     [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)

Original issue reported on code.google.com by lars.he...@gmail.com on 20 Jul 2009 at 12:55

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 16, 2015

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. :)

Original comment by lars.he...@gmail.com on 20 Jul 2009 at 1:04

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. :)

Original comment by lars.he...@gmail.com on 20 Jul 2009 at 1:04

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 16, 2015

I'm working on it. Including some comments ;)

Original comment by h.niederhausen@googlemail.com on 20 Jul 2009 at 1:06

I'm working on it. Including some comments ;)

Original comment by h.niederhausen@googlemail.com on 20 Jul 2009 at 1:06

@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 16, 2015

This issue was closed by r345.

Original comment by h.niederhausen@googlemail.com on 20 Jul 2009 at 1:11

  • Changed state: Fixed
This issue was closed by r345.

Original comment by h.niederhausen@googlemail.com on 20 Jul 2009 at 1:11

  • Changed state: Fixed
@GoogleCodeExporter

This comment has been minimized.

Show comment
Hide comment
@GoogleCodeExporter

GoogleCodeExporter Mar 16, 2015

Original comment by lar...@gmail.com on 1 Sep 2009 at 11:53

  • Added labels: Release5.0.1

Original comment by lar...@gmail.com on 1 Sep 2009 at 11:53

  • Added labels: Release5.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment