Program: 117669
Project: 117669
Buggy source:
public TopicMap process(TopicMap tm,Logger logger) throws TopicMapException {
  log("String_Node_Str");
  Topic fiLang=tm.getTopic("String_Node_Str");
  Topic swLang=tm.getTopic("String_Node_Str");
  Topic enLang=tm.getTopic("String_Node_Str");
  Topic work=tm.getTopic("String_Node_Str");
  Topic isAboutType=tm.getTopic("String_Node_Str");
  Topic isAboutRole=tm.getTopic("String_Node_Str");
  Topic requiredRole=tm.getTopic("String_Node_Str");
  Topic requiredPlayer=tm.getTopic("String_Node_Str");
  if (work == null || isAboutType == null || isAboutRole == null || requiredRole == null || requiredPlayer == null) {
    log("String_Node_Str");
    return tm;
  }
  Topic keywordClassTopic=tm.getTopic("String_Node_Str");
  if (keywordClassTopic == null) {
    keywordClassTopic=tm.createTopic();
    keywordClassTopic.setBaseName("String_Node_Str");
    keywordClassTopic.addSubjectIdentifier(new Locator("String_Node_Str"));
  }
  int splitCounter=0;
  int createTopicCounter=0;
  int createAssociationCounter=0;
  Iterator iter=tm.getTopicsOfType(work).iterator();
  while (iter.hasNext()) {
    Topic t=(Topic)iter.next();
    Vector<Topic> keywords=TopicTools.getPlayers(t,isAboutType,isAboutRole,requiredRole,requiredPlayer);
    int s=keywords.size();
    for (int i=0; i < s; i++) {
      Topic keywordTopic=keywords.elementAt(i);
      if (keywordTopic != null) {
        hlog("String_Node_Str" + getTopicName(keywordTopic) + "String_Node_Str");
        StringTokenizer st=new StringTokenizer(keywordTopic.getBaseName(),"String_Node_Str");
        while (st.hasMoreTokens()) {
          String token=st.nextToken();
          token=fixKeyword(token);
          if (token != null && token.length() > 0 && !token.startsWith("String_Node_Str") && !token.startsWith("String_Node_Str")) {
            String siString="String_Node_Str" + token;
            if (siString.length() > 255)             siString=siString.substring(0,255);
            Locator l=cleanDirtyLocator(new Locator(siString));
            Topic newKeyword=tm.getTopic(l);
            if (newKeyword == null) {
              newKeyword=tm.createTopic();
              newKeyword.setBaseName(token + "String_Node_Str");
              newKeyword.setDisplayName("String_Node_Str",token);
              newKeyword.addSubjectIdentifier(l);
              newKeyword.addType(keywordClassTopic);
              createTopicCounter++;
              log("String_Node_Str" + getTopicName(newKeyword) + "String_Node_Str");
            }
            Association a=tm.createAssociation(keywordClassTopic);
            a.addPlayer(newKeyword,keywordClassTopic);
            a.addPlayer(t,work);
            createAssociationCounter++;
          }
        }
      }
      try {
        for (Iterator assos=keywordTopic.getAssociations().iterator(); assos.hasNext(); ) {
          Association a=(Association)assos.next();
          if (a != null)           a.remove();
        }
        keywordTopic.remove();
        splitCounter++;
      }
 catch (      Exception e) {
        log(e);
      }
    }
  }
  log("String_Node_Str" + splitCounter + "String_Node_Str");
  log("String_Node_Str" + createAssociationCounter + "String_Node_Str");
  log("String_Node_Str" + createTopicCounter + "String_Node_Str");
  return tm;
}

Fixed version (ground truth):
public TopicMap process(TopicMap tm,Logger logger) throws TopicMapException {
  log("String_Node_Str");
  Topic fiLang=tm.getTopic("String_Node_Str");
  Topic swLang=tm.getTopic("String_Node_Str");
  Topic enLang=tm.getTopic("String_Node_Str");
  Topic work=tm.getTopic("String_Node_Str");
  Topic isAboutType=tm.getTopic("String_Node_Str");
  Topic isAboutRole=tm.getTopic("String_Node_Str");
  Topic requiredRole=tm.getTopic("String_Node_Str");
  Topic requiredPlayer=tm.getTopic("String_Node_Str");
  if (work == null || isAboutType == null || isAboutRole == null || requiredRole == null || requiredPlayer == null) {
    log("String_Node_Str");
    return tm;
  }
  Topic keywordClassTopic=tm.getTopic("String_Node_Str");
  if (keywordClassTopic == null) {
    keywordClassTopic=tm.createTopic();
    keywordClassTopic.setBaseName("String_Node_Str");
    keywordClassTopic.addSubjectIdentifier(new Locator("String_Node_Str"));
  }
  int splitCounter=0;
  int createTopicCounter=0;
  int createAssociationCounter=0;
  Iterator iter=tm.getTopicsOfType(work).iterator();
  while (iter.hasNext()) {
    Topic t=(Topic)iter.next();
    List<Topic> keywords=TopicTools.getPlayers(t,isAboutType,isAboutRole,requiredRole,requiredPlayer);
    int s=keywords.size();
    for (int i=0; i < s; i++) {
      Topic keywordTopic=keywords.get(i);
      if (keywordTopic != null) {
        hlog("String_Node_Str" + getTopicName(keywordTopic) + "String_Node_Str");
        StringTokenizer st=new StringTokenizer(keywordTopic.getBaseName(),"String_Node_Str");
        while (st.hasMoreTokens()) {
          String token=st.nextToken();
          token=fixKeyword(token);
          if (token != null && token.length() > 0 && !token.startsWith("String_Node_Str") && !token.startsWith("String_Node_Str")) {
            String siString="String_Node_Str" + token;
            if (siString.length() > 255)             siString=siString.substring(0,255);
            Locator l=cleanDirtyLocator(new Locator(siString));
            Topic newKeyword=tm.getTopic(l);
            if (newKeyword == null) {
              newKeyword=tm.createTopic();
              newKeyword.setBaseName(token + "String_Node_Str");
              newKeyword.setDisplayName("String_Node_Str",token);
              newKeyword.addSubjectIdentifier(l);
              newKeyword.addType(keywordClassTopic);
              createTopicCounter++;
              log("String_Node_Str" + getTopicName(newKeyword) + "String_Node_Str");
            }
            Association a=tm.createAssociation(keywordClassTopic);
            a.addPlayer(newKeyword,keywordClassTopic);
            a.addPlayer(t,work);
            createAssociationCounter++;
          }
        }
      }
      try {
        for (Iterator assos=keywordTopic.getAssociations().iterator(); assos.hasNext(); ) {
          Association a=(Association)assos.next();
          if (a != null)           a.remove();
        }
        keywordTopic.remove();
        splitCounter++;
      }
 catch (      Exception e) {
        log(e);
      }
    }
  }
  log("String_Node_Str" + splitCounter + "String_Node_Str");
  log("String_Node_Str" + createAssociationCounter + "String_Node_Str");
  log("String_Node_Str" + createTopicCounter + "String_Node_Str");
  return tm;
}