From: Richard G. <ric...@ya...> - 2005-03-03 16:08:19
|
Hi Back in December I posted as question about a NullPointerException I was getting when trying to call the getTopic() method of a MergedTopicSubjectClashException. If igured it was probably something I was doing wrong. http://sourceforge.net/mailarchive/message.php?msg_id=10254897 I didn't get any answers then, and left it, as I could get around it by preventing the name based merge with. myProperties.put("tm4j.name.based.merge","false"); I've been back and another look at it, and had a look at the code for this exception class, and I think I found the problem. The addition of the lines "this.ti=t1; this.t2=t2;" into the code, as below, sorts it out. public class MergedTopicSubjectClashException extends TopicMapProcessingException { Topic t1; Topic t2; /** Constructs a new merged topic subject clash exception. * * @param t1 the first topic included in the failed merge operation. * @param t2 the other topic included in the failed merge operation. */ public MergedTopicSubjectClashException(Topic t1, Topic t2) { super("Attempted to merge two topics with different subjects,"); this.t1 = t1; this.t2 = t2; } /** Retrieves the two topics involved in the failed merge operation. * * @param ret A placeholder array of topics to be filled with the two * topics involved in the failed merge operation. Note that if * this is <code>null</code> or an array holding less than * two {@link Topic}s, a new array will be created in its place. * @return An array containing the two {@link Topic}s involved in the * failed merge operation. */ public Topic[] getTopics(Topic[] ret) { if ((ret == null) || (ret.length < 2)) { ret = new Topic[2]; } //System.out.println("Getting clashed topics"); ret[0] = t1; ret[1] = t2; return ret; } } Cheers, Richard. Send instant messages to your online friends http://uk.messenger.yahoo.com |