From: Dicheva, D. <dic...@ws...> - 2008-06-07 20:17:29
|
Hi Lars and All, I have a new problem :-( I discovered that if I delete a topic with a certain name and after that try to create a topic with the same name I cannot (see the trace below). The exception is on the line: t.createTopicName(topicName, null); (I want the name to be unconstrained) I also tried: t.createTopicName(topicName, new HashSet()); I checked: t is not null; and the topicName ( tested with 't2') is in the TopicNamesIndex before the deletion of the topic name and not after that (so everything looks normal). Below is the code I used to test the deletion of the topic name when deleting a topic, and the result (originally the removing of the scoping topics was not present): TopicNamesIndex tni = UNames.getTopicNamesIndex(UTopicMaps.topicMap); System.out.println("tni before reindex"); Iterator i = tni.getTopicNamesByValue("t2").iterator(); while (i.hasNext()) System.out.println(i.next()); Iterator in = t.getTopicNames().iterator(); while (in.hasNext()){ TopicName bn = (TopicName) in.next(); Iterator itScope = bn.getScope().iterator(); while (itScope.hasNext()) { bn.removeScopingTopic((Topic)itScope.next()); } bn.remove(); } tni.reindex(); System.out.println("tni after reindex"); i = tni.getTopicNamesByValue("t2").iterator(); while (i.hasNext()) System.out.println(i.next()); System.out.println("deleted topic: "+t.getObjectId()); .. Here is the result [java] deleting topic: t2 [java] tni before reindex [java] org.tm4j.tmapi.core.TMAPIBaseNameImpl@6cb8439c [java] tni after reindex [java] deleted topic: x1pdm557si-28a I have set: tmfac.setFeature("http://tmapi.org/features/merge/byTopicName",true); When I save the topic map after deleting the topic in the xtm file the topic is not present, and yet, when I try to create a new topic with that name, I get the exception. I am really stuck and don't know what else to try. Please help. Thanks, Darina --- [java] java.lang.RuntimeException: java.lang.NullPointerException [java] at org.tm4j.tmapi.core.TMAPITopicImpl.createTopicName(TMAPITopicImpl.java:8 0) [java] at org.tm4l.core.utilities.utilitiesTM.UTopics.returnNewTopic(UTopics.java: 122) [java] at org.tm4l.core.ui.dialogs.DialogCreateNewTopic.actionPerformed(DialogCrea teNewTopic.java:164) [java] at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) [java] at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) [java] at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) [java] at javax.swing.DefaultButtonModel.setPressed(Unknown Source) [java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) .......... [java] Caused by: java.lang.NullPointerException [java] at org.tm4j.topicmap.memory.TopicImpl.addMergedTopic(TopicImpl.java:1053) [java] at org.tm4j.topicmap.memory.TopicMapImpl.scopedNamesChange(TopicMapImpl.jav a:990) [java] at org.tm4j.topicmap.memory.TopicMapImpl.propertyChange(TopicMapImpl.java:1 087) [java] at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) [java] at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) [java] at org.tm4j.topicmap.memory.TopicMapObjectImpl.firePropertyChange(TopicMapO bjectImpl.java:254) [java] at org.tm4j.topicmap.memory.TopicImpl.makeScopedNames(TopicImpl.java:1311) [java] at org.tm4j.topicmap.memory.TopicImpl.propertyChange(TopicImpl.java:1459) [java] at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) [java] at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source) [java] at org.tm4j.topicmap.memory.TopicMapObjectImpl.firePropertyChange(TopicMapO bjectImpl.java:254) [java] at org.tm4j.topicmap.memory.BaseNameImpl.setData(BaseNameImpl.java:80) [java] at org.tm4j.tmapi.core.TMAPITopicImpl.createTopicName(TMAPITopicImpl.java:7 3) [java] ... 59 more |