Program: 92077
Project: 92077
Buggy source:
private IStatus setTraceType(FileAndName traceToImport){
  IPath path=fTargetFolder.getFullPath().append(traceToImport.getName());
  IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember(path);
  if (resource != null) {
    try {
      boolean traceTypeOK=false;
      String traceBundle=null, traceTypeId=null, traceIcon=null;
      traceTypeId=traceToImport.getTraceTypeId();
      IConfigurationElement ce=TmfTraceType.getInstance().getTraceAttributes(traceTypeId);
      if ((ce != null) && (ce.getContributor() != null)) {
        traceTypeOK=true;
        traceBundle=ce.getContributor().getName();
        traceTypeId=ce.getAttribute(TmfTraceType.ID_ATTR);
        traceIcon=ce.getAttribute(TmfTraceType.ICON_ATTR);
      }
      final String traceType=traceTypeId;
      if (!traceTypeOK && (traceType.startsWith(TmfTraceType.CUSTOM_TXT_CATEGORY) || traceType.startsWith(TmfTraceType.CUSTOM_XML_CATEGORY))) {
        traceTypeOK=true;
        traceBundle=Activator.getDefault().getBundle().getSymbolicName();
        traceTypeId=CustomTxtTrace.class.getCanonicalName() + "String_Node_Str" + traceType;
        traceIcon=DEFAULT_TRACE_ICON_PATH;
      }
      if (traceTypeOK) {
        resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE,traceBundle);
        resource.setPersistentProperty(TmfCommonConstants.TRACETYPE,traceTypeId);
        resource.setPersistentProperty(TmfCommonConstants.TRACEICON,traceIcon);
      }
      TmfProjectElement tmfProject=TmfProjectRegistry.getProject(resource.getProject());
      if (tmfProject != null) {
        for (        TmfTraceElement traceElement : tmfProject.getTracesFolder().getTraces()) {
          if (traceElement.getName().equals(resource.getName())) {
            traceElement.refreshTraceType();
            break;
          }
        }
      }
    }
 catch (    CoreException e) {
      Activator.getDefault().logError(Messages.BatchImportTraceWizardErrorImportingTraceResource + "String_Node_Str" + resource.getName(),e);
    }
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
private IStatus setTraceType(FileAndName traceToImport){
  IStatus validate=Status.OK_STATUS;
  IPath path=fTargetFolder.getFullPath().append(traceToImport.getName());
  IResource resource=ResourcesPlugin.getWorkspace().getRoot().findMember(path);
  if (resource != null) {
    try {
      boolean traceTypeOK=false;
      String traceBundle=null, traceTypeId=null, traceIcon=null;
      traceTypeId=traceToImport.getTraceTypeId();
      IConfigurationElement ce=TmfTraceType.getInstance().getTraceAttributes(traceTypeId);
      if ((ce != null) && (ce.getContributor() != null)) {
        traceTypeOK=true;
        traceBundle=ce.getContributor().getName();
        traceTypeId=ce.getAttribute(TmfTraceType.ID_ATTR);
        traceIcon=ce.getAttribute(TmfTraceType.ICON_ATTR);
      }
      final String traceType=traceTypeId;
      final boolean startsWithTxt=traceType.startsWith(TmfTraceType.CUSTOM_TXT_CATEGORY);
      final boolean startsWithXML=traceType.startsWith(TmfTraceType.CUSTOM_XML_CATEGORY);
      if (!traceTypeOK && (startsWithTxt || startsWithXML)) {
        final char SEPARATOR=':';
        traceTypeOK=true;
        String traceTypeToken[]=traceType.split("String_Node_Str",2);
        if (traceTypeToken.length == 2) {
          traceBundle=Activator.getDefault().getBundle().getSymbolicName();
          if (startsWithTxt) {
            traceTypeId=CustomTxtTrace.class.getCanonicalName() + SEPARATOR + traceTypeToken[1];
          }
 else {
            traceTypeId=CustomXmlTrace.class.getCanonicalName() + SEPARATOR + traceTypeToken[1];
          }
          traceIcon=DEFAULT_TRACE_ICON_PATH;
        }
 else {
          traceTypeOK=false;
        }
      }
      if (traceTypeOK) {
        resource.setPersistentProperty(TmfCommonConstants.TRACEBUNDLE,traceBundle);
        resource.setPersistentProperty(TmfCommonConstants.TRACETYPE,traceTypeId);
        resource.setPersistentProperty(TmfCommonConstants.TRACEICON,traceIcon);
      }
      TmfProjectElement tmfProject=TmfProjectRegistry.getProject(resource.getProject());
      if (tmfProject != null) {
        final TmfTraceFolder tracesFolder=tmfProject.getTracesFolder();
        tracesFolder.refresh();
        List<TmfTraceElement> traces=tracesFolder.getTraces();
        boolean found=false;
        for (        TmfTraceElement traceElement : traces) {
          if (traceElement.getName().equals(resource.getName())) {
            traceElement.refreshTraceType();
            found=true;
            break;
          }
        }
        if (!found) {
          TmfTraceElement te=new TmfTraceElement(traceToImport.getName(),resource,tracesFolder);
          te.refreshTraceType();
          traces=tracesFolder.getTraces();
          for (          TmfTraceElement traceElement : traces) {
            if (traceElement.getName().equals(resource.getName())) {
              traceElement.refreshTraceType();
              ITmfTrace tmfTrace=null;
              try {
                tmfTrace=traceElement.instantiateTrace();
                if (tmfTrace != null) {
                  validate=tmfTrace.validate(tmfProject.getResource(),traceElement.getLocation().getPath());
                }
 else {
                  return new Status(IStatus.ERROR,traceElement.getName(),"String_Node_Str" + traceElement.getLocation().getPath());
                }
              }
  finally {
                if (tmfTrace != null) {
                  tmfTrace.dispose();
                }
              }
              break;
            }
          }
        }
      }
    }
 catch (    CoreException e) {
      Activator.getDefault().logError(Messages.BatchImportTraceWizardErrorImportingTraceResource + "String_Node_Str" + resource.getName(),e);
    }
  }
  return validate;
}