From: Richard G. <ric...@ya...> - 2004-12-08 14:53:51
|
Hi All, I'm getting a TopicMapRuntimeException, ultimately caused by a MergedTopicSubjectClashException, when I try to load a topic map into a particular topic map into a provide. A portion of the stack track is below. TopicMapProviderException. Caused by: . Cause: org.tm4j.topicmap.TopicMapProcessingException: Cause: org.tm4j.topicmap.TopicMapRuntimeException: Cause: org.tm4j.topicmap.MergedTopicSubjectClashException: Attempted to merge two topics with different subjects, Cause:Attempted to merge two topics with different subjects, at org.tm4j.topicmap.source.TopicMapSourceSupport.addTopicMap(TopicMapSourceSupport.java:37) at org.tm4j.topicmap.source.TopicMapSourceSupport.addTopicMap(TopicMapSourceSupport.java:69) at mips.genre.topicmaps.AddTopicMap.addToMemory(AddTopicMap.java:126) at mips.genre.topicmaps.AddTopicMap.main(AddTopicMap.java:57) I want to use the MergedTopicSubjectClashException.getTopics() method to find out the causing of the problem, so I have the following catch block: catch(Exception e) { if (e.getCause().getCause().getCause() instanceof MergedTopicSubjectClashException) { Topic clashTopics[] = new Topic[2]; ((MergedTopicSubjectClashException) e.getCause().getCause().getCause()).getTopics(clashTopics); for (int i=0; i<clashTopics.length; i++) { Topic ct = clashTopics[i]; System.out.println(ct.getID()); Iterator nameIt = ct.getNames().iterator(); while(nameIt.hasNext()) { BaseName name = (BaseName)nameIt.next(); System.out.println(name.getData()); } Iterator locIt = ct.getNames().iterator(); while(locIt.hasNext()) { URILocator loc = (URILocator)locIt.next(); System.out.println(loc.getAddress()); } } e.printStackTrace(); } else { e.printStackTrace(); } } But, it looks like the getTopics() method isn't returning anything, as I get a NullPointerException generated by the line: System.out.println(ct.getID()); This may just be something I'm doing wrong, so if anyone can point me in the right direction I'd be grateful. Cheers, Richard. ___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com |