Program: 138586
Project: 138586
Buggy source:
/** 
 * DOC bZhou Comment method "createItem".
 * @param element
 * @return
 */
public Item createItem(ModelElement element){
  Item item=null;
  if (ModelElementIdentifier.isAnalysis(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQAnalysisItem();
    ((TDQAnalysisItem)item).setAnalysis((Analysis)element);
  }
 else   if (ModelElementIdentifier.isDQRule(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQBusinessRuleItem();
    ((TDQBusinessRuleItem)item).setDqrule((DQRule)element);
  }
 else   if (ModelElementIdentifier.isDataProvider(element)) {
    if (element instanceof DatabaseConnection) {
      item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
      ((ConnectionItem)item).setConnection((DatabaseConnection)element);
    }
 else     if (element instanceof MDMConnection) {
      item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createMDMConnectionItem();
      ((ConnectionItem)item).setConnection((MDMConnection)element);
    }
    ((ConnectionItem)item).setConnection((Connection)element);
  }
 else   if (ModelElementIdentifier.isID(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQIndicatorDefinitionItem();
    ((TDQIndicatorDefinitionItem)item).setIndicatorDefinition((IndicatorDefinition)element);
  }
 else   if (ModelElementIdentifier.isPattern(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQPatternItem();
    ((TDQPatternItem)item).setPattern((Pattern)element);
  }
 else   if (ModelElementIdentifier.isReport(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQReportItem();
    ((TDQReportItem)item).setReport((Report)element);
  }
 else {
    item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createTDQItem();
  }
  ItemState itemState=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
  itemState.setDeleted(false);
  item.setState(itemState);
  Resource eResource=element.eResource();
  if (eResource != null) {
    URI uri=eResource.getURI();
    if (item instanceof TDQItem) {
      ((TDQItem)item).setFilename(URI.decode(uri.lastSegment()));
    }
    if (uri.isPlatform()) {
      IPath elementPath=new Path(uri.toPlatformString(true)).removeLastSegments(1);
      IPath typedPath=ResourceManager.getRootProject().getFullPath().append(PropertyHelper.getItemTypedPath(item));
      IPath statePath=elementPath.makeRelativeTo(typedPath);
      itemState.setPath(statePath.toString());
    }
  }
  return item;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createItem".
 * @param element
 * @return
 */
public Item createItem(ModelElement element){
  Item item=null;
  if (ModelElementIdentifier.isAnalysis(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQAnalysisItem();
    ((TDQAnalysisItem)item).setAnalysis((Analysis)element);
  }
 else   if (ModelElementIdentifier.isDQRule(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQBusinessRuleItem();
    ((TDQBusinessRuleItem)item).setDqrule((DQRule)element);
  }
 else   if (ModelElementIdentifier.isDataProvider(element)) {
    if (element instanceof DatabaseConnection) {
      item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createDatabaseConnectionItem();
      ((ConnectionItem)item).setConnection((DatabaseConnection)element);
    }
 else     if (element instanceof MDMConnection) {
      item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createMDMConnectionItem();
      ((ConnectionItem)item).setConnection((MDMConnection)element);
    }
    ((ConnectionItem)item).setConnection((Connection)element);
  }
 else   if (ModelElementIdentifier.isID(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQIndicatorDefinitionItem();
    ((TDQIndicatorDefinitionItem)item).setIndicatorDefinition((IndicatorDefinition)element);
  }
 else   if (ModelElementIdentifier.isPattern(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQPatternItem();
    ((TDQPatternItem)item).setPattern((Pattern)element);
  }
 else   if (ModelElementIdentifier.isReport(element)) {
    item=PropertiesFactory.eINSTANCE.createTDQReportItem();
    ((TDQReportItem)item).setReport((Report)element);
  }
 else {
    item=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createTDQItem();
  }
  ItemState itemState=org.talend.core.model.properties.PropertiesFactory.eINSTANCE.createItemState();
  itemState.setDeleted(false);
  item.setState(itemState);
  if (item instanceof TDQItem) {
    ((TDQItem)item).setFilename(element.getName() + "String_Node_Str" + MetadataHelper.getVersion(element)+ PluginConstant.DOT_STRING+ this.getFileExtension());
  }
  Resource eResource=element.eResource();
  if (eResource != null) {
    URI uri=eResource.getURI();
    if (item instanceof TDQItem) {
      ((TDQItem)item).setFilename(URI.decode(uri.lastSegment()));
    }
    if (uri.isPlatform()) {
      IPath elementPath=new Path(uri.toPlatformString(true)).removeLastSegments(1);
      IPath typedPath=ResourceManager.getRootProject().getFullPath().append(PropertyHelper.getItemTypedPath(item));
      IPath statePath=elementPath.makeRelativeTo(typedPath);
      itemState.setPath(statePath.toString());
    }
  }
  return item;
}