Program: 138173
Project: 138173
Buggy source:
/** 
 * DOC klliu Comment method "createSystemFolder".
 * @param node
 * @param resConstant
 * @return
 * @throws PersistenceException
 */
public RepositoryNode createRepositoryNodeSystemFolder(FolderHelper folderHelper,RepositoryNode node,EResourceConstant resConstant) throws PersistenceException {
  IRepositoryViewObject folder=null;
  DQRepositoryNode subFolderNode=null;
  if (folderHelper != null) {
    FolderItem folder2=folderHelper.getFolder(resConstant.getPath());
    folder=new Folder(folder2.getProperty(),retrieveRepObjectTypeByPath(resConstant.getPath()));
  }
 else {
    folder=ProxyRepositoryFactory.getInstance().createFolder(retrieveRepObjectTypeByPath(resConstant.getPath()),Path.EMPTY,resConstant.getName());
  }
switch (resConstant) {
case ANALYSIS:
    AnalysisFolderRepNode anaFolderNode=new AnalysisFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
  folder.setRepositoryNode(anaFolderNode);
node.getChildren().add(anaFolderNode);
return anaFolderNode;
case REPORTS:
ReportFolderRepNode repFolderNode=new ReportFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(repFolderNode);
node.getChildren().add(repFolderNode);
return repFolderNode;
case INDICATORS:
IndicatorFolderRepNode indicatorFolderRepNode=new IndicatorFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(indicatorFolderRepNode);
node.getChildren().add(indicatorFolderRepNode);
return indicatorFolderRepNode;
case JRXML_TEMPLATE:
JrxmlTempFolderRepNode jrxmlFolderNode=new JrxmlTempFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(jrxmlFolderNode);
node.getChildren().add(jrxmlFolderNode);
return jrxmlFolderNode;
case SOURCE_FILES:
SourceFileFolderRepNode sourceFileFolder=new SourceFileFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(sourceFileFolder);
node.getChildren().add(sourceFileFolder);
return sourceFileFolder;
case PATTERNS:
PatternFolderRepNode regexFolder2=new PatternFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(regexFolder2);
node.getChildren().add(regexFolder2);
return regexFolder2;
case RULES:
RulesFolderRepNode ruleFolder=new RulesFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(ruleFolder);
node.getChildren().add(ruleFolder);
return ruleFolder;
case DB_CONNECTIONS:
DBConnectionFolderRepNode dbFolder=new DBConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(dbFolder);
node.getChildren().add(dbFolder);
return dbFolder;
case MDM_CONNECTIONS:
MDMConnectionFolderRepNode mdmFolder=new MDMConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(mdmFolder);
node.getChildren().add(mdmFolder);
return mdmFolder;
case FILEDELIMITED:
DFConnectionFolderRepNode dfmFolder=new DFConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(dfmFolder);
node.getChildren().add(dfmFolder);
return dfmFolder;
case EXCHANGE:
ExchangeFolderRepNode exchangeFolder=new ExchangeFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(exchangeFolder);
node.getChildren().add(exchangeFolder);
return exchangeFolder;
default :
subFolderNode=new DQRepositoryNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(subFolderNode);
node.getChildren().add(subFolderNode);
break;
}
return subFolderNode;
}

Fixed version (ground truth):
/** 
 * DOC klliu Comment method "createSystemFolder".
 * @param node
 * @param resConstant
 * @return
 * @throws PersistenceException
 */
public RepositoryNode createRepositoryNodeSystemFolder(FolderHelper folderHelper,RepositoryNode node,EResourceConstant resConstant) throws PersistenceException {
  IRepositoryViewObject folder=null;
  DQRepositoryNode subFolderNode=null;
  if (folderHelper != null) {
    FolderItem folder2=folderHelper.getFolder(resConstant.getPath());
    folder=new Folder(folder2.getProperty(),retrieveRepObjectTypeByPath(resConstant.getPath()));
  }
 else {
    folder=ProxyRepositoryFactory.getInstance().createFolder(retrieveRepObjectTypeByPath(resConstant.getPath()),Path.EMPTY,resConstant.getName());
  }
switch (resConstant) {
case ANALYSIS:
    AnalysisFolderRepNode anaFolderNode=new AnalysisFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
  folder.setRepositoryNode(anaFolderNode);
node.getChildren().add(anaFolderNode);
return anaFolderNode;
case REPORTS:
ReportFolderRepNode repFolderNode=new ReportFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(repFolderNode);
node.getChildren().add(repFolderNode);
return repFolderNode;
case INDICATORS:
IndicatorFolderRepNode indicatorFolderRepNode=new IndicatorFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(indicatorFolderRepNode);
node.getChildren().add(indicatorFolderRepNode);
return indicatorFolderRepNode;
case JRXML_TEMPLATE:
JrxmlTempFolderRepNode jrxmlFolderNode=new JrxmlTempFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(jrxmlFolderNode);
node.getChildren().add(jrxmlFolderNode);
return jrxmlFolderNode;
case SOURCE_FILES:
SourceFileFolderRepNode sourceFileFolder=new SourceFileFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(sourceFileFolder);
node.getChildren().add(sourceFileFolder);
return sourceFileFolder;
case PATTERNS:
PatternFolderRepNode regexFolder2=new PatternFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(regexFolder2);
node.getChildren().add(regexFolder2);
return regexFolder2;
case RULES:
RulesFolderRepNode ruleFolder=new RulesFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(ruleFolder);
node.getChildren().add(ruleFolder);
return ruleFolder;
case DB_CONNECTIONS:
DBConnectionFolderRepNode dbFolder=new DBConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(dbFolder);
node.getChildren().add(dbFolder);
return dbFolder;
case MDM_CONNECTIONS:
MDMConnectionFolderRepNode mdmFolder=new MDMConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(mdmFolder);
node.getChildren().add(mdmFolder);
return mdmFolder;
case FILEDELIMITED:
DFConnectionFolderRepNode dfmFolder=new DFConnectionFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(dfmFolder);
node.getChildren().add(dfmFolder);
return dfmFolder;
case EXCHANGE:
ExchangeFolderRepNode exchangeFolder=new ExchangeFolderRepNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(exchangeFolder);
node.getChildren().add(exchangeFolder);
return exchangeFolder;
default :
subFolderNode=new DQRepositoryNode(folder,node,ENodeType.SYSTEM_FOLDER);
folder.setRepositoryNode(subFolderNode);
node.getChildren().add(subFolderNode);
if (resConstant.equals(EResourceConstant.PATTERNS)) {
createRepositoryNodeSystemFolder(folderHelper,subFolderNode,EResourceConstant.PATTERN_REGEX);
createRepositoryNodeSystemFolder(folderHelper,subFolderNode,EResourceConstant.PATTERN_SQL);
}
break;
}
return subFolderNode;
}