nus-yam/ex-repair huggingface dataset:
Program: 130158
Project: 130158
Buggy source:
protected PropertiesWizardPage(String pageName,final Property property,IPath destinationPath,boolean readOnly,boolean editPath,String lastVersionFound){
  super(pageName);
  statusHelper=new StatusHelper(CoreRuntimePlugin.getInstance().getProxyRepositoryFactory());
  this.destinationPath=destinationPath;
  this.readOnly=readOnly;
  this.editPath=editPath;
  nameStatus=createOkStatus();
  purposeStatus=createOkStatus();
  commentStatus=createOkStatus();
  this.lastVersionFound=lastVersionFound;
  this.property=property;
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        listExistingObjects=loadRepositoryViewObjectList();
      }
 catch (      PersistenceException e) {
        return new org.eclipse.core.runtime.Status(IStatus.ERROR,"String_Node_Str",1,"String_Node_Str",e);
      }
      retrieveNameFinished=true;
      Display d=DisplayUtils.getDisplay();
      if (d != null) {
        d.syncExec(new Runnable(){
          public void run(){
            evaluateTextField();
          }
        }
);
      }
      return Status.OK_STATUS;
    }
  }
;
  job.setUser(false);
  job.setPriority(Job.BUILD);
  job.schedule();
  IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  allowVerchange=brandingService.getBrandingConfiguration().isAllowChengeVersion();
}

Fixed version (ground truth):
protected PropertiesWizardPage(String pageName,final Property property,IPath destinationPath,boolean readOnly,boolean editPath,String lastVersionFound){
  super(pageName);
  statusHelper=new StatusHelper(CoreRuntimePlugin.getInstance().getProxyRepositoryFactory());
  this.destinationPath=destinationPath;
  this.readOnly=readOnly;
  this.editPath=editPath;
  nameStatus=createOkStatus();
  purposeStatus=createOkStatus();
  commentStatus=createOkStatus();
  this.lastVersionFound=lastVersionFound;
  this.property=property;
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        listExistingObjects=loadRepositoryViewObjectList();
      }
 catch (      PersistenceException e) {
        return new org.eclipse.core.runtime.Status(IStatus.ERROR,"String_Node_Str",1,"String_Node_Str",e);
      }
      retrieveNameFinished=true;
      Display d=DisplayUtils.getDisplay();
      if (d != null) {
        d.syncExec(new Runnable(){
          @Override public void run(){
            evaluateTextField();
          }
        }
);
      }
      return Status.OK_STATUS;
    }
  }
;
  job.setUser(false);
  job.setPriority(Job.BUILD);
  job.schedule();
  IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
  allowVerchange=brandingService.getBrandingConfiguration().isAllowChengeVersion();
}
Program: 130159
Project: 130159
Buggy source:
public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}

Fixed version (ground truth):
@Override public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}
Program: 130161
Project: 130161
Buggy source:
public void treeExpanded(TreeExpansionEvent event){
  setItemImage(event,false);
}

Fixed version (ground truth):
@Override public void treeExpanded(TreeExpansionEvent event){
  setItemImage(event,false);
}
Program: 130162
Project: 130162
Buggy source:
public Object getParent(Object element){
  return null;
}

Fixed version (ground truth):
@Override public Object getParent(Object element){
  return null;
}
Program: 130163
Project: 130163
Buggy source:
public void treeCollapsed(TreeExpansionEvent event){
  setItemImage(event,true);
}

Fixed version (ground truth):
@Override public void treeCollapsed(TreeExpansionEvent event){
  setItemImage(event,true);
}
Program: 130164
Project: 130164
Buggy source:
public Exception getExecuteException(){
  return executeException;
}

Fixed version (ground truth):
public Throwable getExecuteException(){
  return executeException;
}
Program: 130165
Project: 130165
Buggy source:
@Override public T call() throws Exception {
  T result=null;
  try {
    result=runnableWithCancel(monitor);
  }
 catch (  Exception e) {
    executeException=e;
  }
  return result;
}

Fixed version (ground truth):
@Override public T call() throws Exception {
  T result=null;
  try {
    result=runnableWithCancel(monitor);
  }
 catch (  Throwable e) {
    executeException=e;
  }
  return result;
}
Program: 130166
Project: 130166
Buggy source:
abstract protected T runnableWithCancel(IProgressMonitor monitor) throws Exception ;

Fixed version (ground truth):
abstract protected T runnableWithCancel(IProgressMonitor monitor) throws Throwable ;
Program: 130169
Project: 130169
Buggy source:
/** 
 * According to the valid resource path, resolve the EMF properties file, and check the overwrite status or be valid item or not, etc.
 * @param monitor
 * @param resManager
 * @param resourcePath according to the this path to calculate the item record.
 * @param overwrite
 * @return if not valid, will return null.
 */
public ImportItem computeImportItem(IProgressMonitor monitor,ResourcesManager resManager,IPath resourcePath,boolean overwrite) throws Exception {
  if (resManager == null || resourcePath == null) {
    return null;
  }
  if (!ImportCacheHelper.getInstance().getXmiResourceManager().isPropertyFile(resourcePath.lastSegment())) {
    return null;
  }
  ImportItem importItem=new ImportItem(resourcePath);
  Resource resource=HandlerUtil.loadResource(resManager,importItem);
  if (resource != null) {
    importItem.setProperty((Property)EcoreUtil.getObjectByType(resource.getContents(),PropertiesPackage.eINSTANCE.getProperty()));
  }
 else {
    ResourceNotFoundException ex=new ResourceNotFoundException(Messages.getString("String_Node_Str",importItem.getPath().lastSegment(),HandlerUtil.getValidItemRelativePath(resManager,importItem.getPath())));
    importItem.addError(ex.getMessage());
  }
  return importItem;
}

Fixed version (ground truth):
/** 
 * According to the valid resource path, resolve the EMF properties file, and check the overwrite status or be valid item or not, etc.
 * @param monitor
 * @param resManager
 * @param resourcePath according to the this path to calculate the item record.
 * @param overwrite
 * @return if not valid, will return null.
 */
public ImportItem computeImportItem(IProgressMonitor monitor,ResourcesManager resManager,IPath resourcePath,boolean overwrite) throws Exception {
  if (resManager == null || resourcePath == null) {
    return null;
  }
  if (!validResourcePath(resourcePath)) {
    return null;
  }
  ImportItem importItem=new ImportItem(resourcePath);
  Resource resource=HandlerUtil.loadResource(resManager,importItem);
  if (resource != null) {
    importItem.setProperty((Property)EcoreUtil.getObjectByType(resource.getContents(),PropertiesPackage.eINSTANCE.getProperty()));
  }
 else {
    ResourceNotFoundException ex=new ResourceNotFoundException(Messages.getString("String_Node_Str",importItem.getPath().lastSegment(),HandlerUtil.getValidItemRelativePath(resManager,importItem.getPath())));
    importItem.addError(ex.getMessage());
  }
  return importItem;
}
Program: 130170
Project: 130170
Buggy source:
/** 
 * return true if it is netezza.
 * @param databaseMetaData
 * @return
 * @throws SQLException
 */
public static boolean isNetezza(DatabaseMetaData databaseMetaData){
  try {
    if (databaseMetaData != null && StringUtils.startsWithIgnoreCase(databaseMetaData.getDriverName(),"String_Node_Str") && StringUtils.startsWithIgnoreCase(databaseMetaData.getDatabaseProductName(),"String_Node_Str")) {
      return true;
    }
  }
 catch (  SQLException e) {
    log.warn(e);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * return true if it is netezza.
 * @param databaseMetaData
 * @return
 * @throws SQLException
 */
public static boolean isNetezza(DatabaseMetaData databaseMetaData){
  try {
    if (databaseMetaData != null && databaseMetaData.getDriverName() != null && databaseMetaData.getDriverName().toLowerCase().startsWith("String_Node_Str") && databaseMetaData.getDatabaseProductName() != null && databaseMetaData.getDatabaseProductName().toLowerCase().startsWith("String_Node_Str")) {
      return true;
    }
  }
 catch (  SQLException e) {
    log.warn(e);
  }
  return false;
}
Program: 130173
Project: 130173
Buggy source:
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=conn.getMetaData().getURL();
          boolean isInProcessModeHsql=ConnectionUtils.isInProcessModeHsql(url);
          if (isInProcessModeHsql) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void closeConnection(boolean force){
  try {
    if (conn != null && !conn.isClosed()) {
      if (isReconnect || force) {
        if (conn.getMetaData() != null) {
          String url=null;
          try {
            url=conn.getMetaData().getURL();
          }
 catch (          Exception e) {
          }
          boolean isInProcessModeHsql=ConnectionUtils.isInProcessModeHsql(url);
          if (isInProcessModeHsql) {
            ConnectionUtils.executeShutDownForHSQL(conn);
          }
        }
        conn.close();
      }
    }
  }
 catch (  SQLException e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
catch (  Exception e) {
    log.error(e.toString());
    throw new RuntimeException(e);
  }
}
Program: 130175
Project: 130175
Buggy source:
/** 
 * DOC cmeng Comment method "doVaribleReplace".
 * @param oldName
 * @param newName
 * @param value
 * @param functionNameAreas
 * @param vStart
 * @param vEnd
 */
private static String doVaribleReplace(String oldName,String newName,String value,List<Point> functionNameAreas,int vStart,int vEnd){
  if (value.trim().isEmpty()) {
    return value;
  }
  StringBuffer replacedString=new StringBuffer();
  int replaceableStart=vStart;
  int replaceableEnd=vEnd;
  for (  Point functionNameArea : functionNameAreas) {
    if (vEnd <= functionNameArea.x) {
      break;
    }
    if (functionNameArea.y <= vStart) {
      continue;
    }
    if (replaceableStart < functionNameArea.x) {
      replaceableEnd=functionNameArea.x;
      String replaceableString=value.substring(replaceableStart,replaceableEnd);
      replacedString.append(doReplace(oldName,newName,replaceableString));
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
 else {
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
    replaceableStart=functionNameArea.y;
  }
  if (replaceableStart < vEnd) {
    String replaceableString=value.substring(replaceableStart,vEnd);
    replacedString.append(doReplace(oldName,newName,replaceableString));
  }
  return replacedString.toString();
}

Fixed version (ground truth):
/** 
 * DOC cmeng Comment method "doVaribleReplace".
 * @param oldName
 * @param newName
 * @param value
 * @param functionNameAreas
 * @param vStart
 * @param vEnd
 */
private static String doVaribleReplace(String oldName,String newName,String value,List<FunctionInfo> functions,int vStart,int vEnd){
  if (value.trim().isEmpty()) {
    return value;
  }
  StringBuffer replacedString=new StringBuffer();
  int replaceableStart=vStart;
  int replaceableEnd=vEnd;
  List<FunctionInfo> replaceableFunctions=FunctionInfo.getFunctionsInSpecifiedAreaFromList(vStart,vEnd,functions);
  for (  FunctionInfo funcInfo : replaceableFunctions) {
    Point functionNameArea=funcInfo.getNameArea();
    if (vEnd <= functionNameArea.x) {
      break;
    }
    if (functionNameArea.y <= vStart) {
      continue;
    }
    if (replaceableStart < functionNameArea.x) {
      replaceableEnd=functionNameArea.x;
      String replaceableString=value.substring(replaceableStart,replaceableEnd);
      replacedString.append(doReplace(oldName,newName,replaceableString));
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
 else {
      replacedString.append(doReplace(oldName,newName,value.substring(functionNameArea.x,functionNameArea.y)));
    }
    replaceableStart=functionNameArea.y;
  }
  if (replaceableStart < vEnd) {
    String replaceableString=value.substring(replaceableStart,vEnd);
    replacedString.append(doReplace(oldName,newName,replaceableString));
  }
  return replacedString.toString();
}
Program: 130176
Project: 130176
Buggy source:
private static int calcMethodArea(String varibleString,String wholeString,int beginIndex,List<Point> functionNameAreas,int lastIndex){
  String regex="String_Node_Str";
  java.util.regex.Pattern pattern=java.util.regex.Pattern.compile(regex);
  Matcher matcher=pattern.matcher(varibleString);
  int i=0;
  int varibleStringMaxIndex=beginIndex + varibleString.length() - 1;
  while (matcher.find()) {
    boolean isInQuota=false;
    int parenthesisNum=0;
    Point functionNameArea=new Point(beginIndex + matcher.start(),beginIndex + matcher.end());
    functionNameAreas.add(functionNameArea);
    if (varibleStringMaxIndex < i || varibleStringMaxIndex < lastIndex) {
      continue;
    }
    for (i=matcher.end(); i < wholeString.length(); i++) {
      char ch=wholeString.charAt(i);
      if (ch == '\"' && !isEscapeSequence(wholeString,i)) {
        isInQuota=!isInQuota;
      }
      if (isInQuota) {
        continue;
      }
      if (ch == '(') {
        parenthesisNum++;
      }
 else       if (ch == ')') {
        parenthesisNum--;
      }
      if (parenthesisNum < 0) {
        break;
      }
    }
  }
  return i;
}

Fixed version (ground truth):
private static int calcMethodArea(String varibleString,String wholeString,int beginIndex,List<FunctionInfo> functions){
  String regex="String_Node_Str";
  java.util.regex.Pattern pattern=java.util.regex.Pattern.compile(regex);
  Matcher matcher=pattern.matcher(varibleString);
  int i=0;
  int currentMaxIndex=i;
  while (matcher.find()) {
    boolean isInQuota=false;
    int parenthesisNum=0;
    int matchedStart=matcher.start();
    int matchedEnd=matcher.end();
    Point functionNameArea=new Point(beginIndex + matchedStart,beginIndex + matchedEnd);
    FunctionInfo funcInfo=new FunctionInfo(functionNameArea);
    Point functionParamArea=new Point(-1,-1);
    funcInfo.setParamArea(functionParamArea);
    i=beginIndex + matchedEnd;
    functionParamArea.x=i;
    for (; i < wholeString.length(); i++) {
      char ch=wholeString.charAt(i);
      if (ch == '\"' && !isEscapeSequence(wholeString,i)) {
        isInQuota=!isInQuota;
      }
      if (isInQuota) {
        continue;
      }
      if (ch == '(') {
        parenthesisNum++;
      }
 else       if (ch == ')') {
        parenthesisNum--;
      }
      if (parenthesisNum < 0) {
        break;
      }
    }
    functionParamArea.y=i;
    FunctionInfo.addFunctionToList(funcInfo,functions);
    if (currentMaxIndex < i) {
      currentMaxIndex=i;
    }
  }
  return currentMaxIndex;
}
Program: 130177
Project: 130177
Buggy source:
public FunctionInfo getParentFunction(int x,int y){
  FunctionInfo parentFunction=null;
  int minDistance=-1;
  for (  FunctionInfo funcInfo : subFunctions) {
    int paramX=funcInfo.paramArea.x;
    int paramY=funcInfo.paramArea.y;
    if (paramX <= x && y <= paramY) {
      if (!funcInfo.subFunctions.isEmpty()) {
        FunctionInfo retFuncInfo=funcInfo.getParentFunction(x,y);
        if (retFuncInfo != null) {
          int distance=x - retFuncInfo.paramArea.x + retFuncInfo.paramArea.y - y;
          if (minDistance < 0 || distance < minDistance) {
            minDistance=distance;
            parentFunction=retFuncInfo;
          }
          continue;
        }
      }
      int distance=x - paramX + paramY - y;
      if (minDistance < 0 || distance < minDistance) {
        minDistance=distance;
        parentFunction=funcInfo;
      }
    }
  }
  if (minDistance < 0) {
    int paramX=this.paramArea.x;
    int paramY=this.paramArea.y;
    if (paramX <= x && y <= paramY) {
      parentFunction=this;
    }
  }
  return parentFunction;
}

Fixed version (ground truth):
public FunctionInfo getParentFunction(int x,int y){
  FunctionInfo parentFunction=null;
  for (  FunctionInfo funcInfo : subFunctions) {
    int paramX=funcInfo.paramArea.x;
    int paramY=funcInfo.paramArea.y;
    if (paramX <= x && y <= paramY) {
      if (!funcInfo.subFunctions.isEmpty()) {
        FunctionInfo retFuncInfo=funcInfo.getParentFunction(x,y);
        if (retFuncInfo != null) {
          return retFuncInfo;
        }
      }
      return funcInfo;
    }
  }
  int paramX=this.paramArea.x;
  int paramY=this.paramArea.y;
  if (paramX <= x && y <= paramY) {
    parentFunction=this;
  }
  return parentFunction;
}
Program: 130178
Project: 130178
Buggy source:
public static List<FunctionInfo> getFunctionsInSpecifiedAreaFromList(int x,int y,List<FunctionInfo> functionList){
  List<FunctionInfo> findedList=new ArrayList<FunctionInfo>();
  for (  FunctionInfo funcInfo : functionList) {
    Point nameArea=funcInfo.getNameArea();
    if (x <= nameArea.x && nameArea.y <= y) {
      findedList.add(funcInfo);
      List<FunctionInfo> subFuncs=funcInfo.getSubFunctions();
      if (subFuncs != null && !subFuncs.isEmpty()) {
        List<FunctionInfo> findedListInSubFuncs=getFunctionsInSpecifiedAreaFromList(x,y,subFuncs);
        if (findedListInSubFuncs != null && !findedListInSubFuncs.isEmpty()) {
          findedList.addAll(findedListInSubFuncs);
        }
      }
    }
 else {
      break;
    }
  }
  return findedList;
}

Fixed version (ground truth):
public static List<FunctionInfo> getFunctionsInSpecifiedAreaFromList(int x,int y,List<FunctionInfo> functionList){
  List<FunctionInfo> findedList=new ArrayList<FunctionInfo>();
  for (  FunctionInfo funcInfo : functionList) {
    Point nameArea=funcInfo.getNameArea();
    if (y < nameArea.y) {
      break;
    }
    if (x <= nameArea.x && nameArea.y <= y) {
      findedList.add(funcInfo);
      List<FunctionInfo> subFuncs=funcInfo.getSubFunctions();
      if (subFuncs != null && !subFuncs.isEmpty()) {
        List<FunctionInfo> findedListInSubFuncs=getFunctionsInSpecifiedAreaFromList(x,y,subFuncs);
        if (findedListInSubFuncs != null && !findedListInSubFuncs.isEmpty()) {
          findedList.addAll(findedListInSubFuncs);
        }
      }
    }
  }
  return findedList;
}
Program: 130179
Project: 130179
Buggy source:
@Override public ResultSet getTables(String catalog,String database,String tableNamePattern,String[] types) throws SQLException {
  if (databaseName != null) {
    database=databaseName;
  }
  String sql=null;
  if (types != null && types.length > 0) {
    sql="String_Node_Str" + database + "String_Node_Str"+ addTypesToSql(types)+ "String_Node_Str"+ tableNamePattern+ "String_Node_Str";
  }
 else {
    sql="String_Node_Str" + database + "String_Node_Str"+ tableNamePattern+ "String_Node_Str";
  }
  ResultSet rs=null;
  Statement stmt=null;
  List<String[]> list=new ArrayList<String[]>();
  try {
    stmt=connection.createStatement();
    rs=stmt.executeQuery(sql);
    while (rs.next()) {
      String name=rs.getString("String_Node_Str").trim();
      if (database == null || "String_Node_Str".equals(database)) {
        database=rs.getString("String_Node_Str").trim();
      }
      String type=rs.getString("String_Node_Str").trim();
      String[] r=new String[]{"String_Node_Str",database,name,type,"String_Node_Str"};
      list.add(r);
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
 finally {
    try {
      rs.close();
      stmt.close();
    }
 catch (    Exception e) {
    }
  }
  TeradataResultSet tableResultSet=new TeradataResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}

Fixed version (ground truth):
@Override public ResultSet getTables(String catalog,String database,String tableNamePattern,String[] types) throws SQLException {
  if (databaseName != null && !databaseName.trim().isEmpty()) {
    database=databaseName;
  }
  String sql=null;
  if (types != null && types.length > 0) {
    sql="String_Node_Str" + database + "String_Node_Str"+ addTypesToSql(types)+ "String_Node_Str"+ tableNamePattern+ "String_Node_Str";
  }
 else {
    sql="String_Node_Str" + database + "String_Node_Str"+ tableNamePattern+ "String_Node_Str";
  }
  ResultSet rs=null;
  Statement stmt=null;
  List<String[]> list=new ArrayList<String[]>();
  try {
    stmt=connection.createStatement();
    rs=stmt.executeQuery(sql);
    while (rs.next()) {
      String name=rs.getString("String_Node_Str").trim();
      if (database == null || "String_Node_Str".equals(database)) {
        database=rs.getString("String_Node_Str").trim();
      }
      String type=rs.getString("String_Node_Str").trim();
      String[] r=new String[]{"String_Node_Str",database,name,type,"String_Node_Str"};
      list.add(r);
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
 finally {
    try {
      rs.close();
      stmt.close();
    }
 catch (    Exception e) {
    }
  }
  TeradataResultSet tableResultSet=new TeradataResultSet();
  tableResultSet.setMetadata(TABLE_META);
  tableResultSet.setData(list);
  return tableResultSet;
}
Program: 130180
Project: 130180
Buggy source:
/** 
 * addButtonControls.
 * @param cancelButton
 */
@Override protected void addUtilsButtonListeners(){
  checkButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      StringBuffer retProposedSchema=new StringBuffer();
      checkConnection(retProposedSchema);
      if (0 < retProposedSchema.length()) {
        if (schemaText != null) {
          schemaText.setText(retProposedSchema.toString());
        }
      }
      if (isHiveDBConnSelected()) {
        if (isHiveEmbeddedMode()) {
          try {
            forceSetFlagForHiveCreateDefaultDB();
          }
 catch (          ClassNotFoundException e1) {
            e1.printStackTrace();
          }
          doRemoveHiveSetup();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * addButtonControls.
 * @param cancelButton
 */
@Override protected void addUtilsButtonListeners(){
  checkButton.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    final SelectionEvent e){
      StringBuffer retProposedSchema=new StringBuffer();
      checkConnection(retProposedSchema);
      if (0 < retProposedSchema.length()) {
        if (ManagerConnection.isSchemaFromSidOrDatabase(EDatabaseTypeName.getTypeFromDbType(dbTypeCombo.getItem(dbTypeCombo.getSelectionIndex())))) {
          if (sidOrDatabaseText != null) {
            sidOrDatabaseText.setText(retProposedSchema.toString());
          }
        }
 else         if (schemaText != null) {
          schemaText.setText(retProposedSchema.toString());
        }
      }
      if (isHiveDBConnSelected()) {
        if (isHiveEmbeddedMode()) {
          try {
            forceSetFlagForHiveCreateDefaultDB();
          }
 catch (          ClassNotFoundException e1) {
            e1.printStackTrace();
          }
          doRemoveHiveSetup();
        }
      }
    }
  }
);
}
Program: 130181
Project: 130181
Buggy source:
@Override public void applicationRunning(){
  org.eclipse.e4.ui.workbench.IWorkbench e4Workbench=(org.eclipse.e4.ui.workbench.IWorkbench)PlatformUI.getWorkbench();
  PerspectiveReviewUtil perspectiveReviewUtil=new PerspectiveReviewUtil();
  ContextInjectionFactory.inject(perspectiveReviewUtil,e4Workbench.getApplication().getContext().getActiveLeaf());
  perspectiveReviewUtil.checkPerspectiveDisplayItems();
}

Fixed version (ground truth):
@Override public void applicationRunning(){
  if (!PlatformUI.isWorkbenchRunning()) {
    return;
  }
  org.eclipse.e4.ui.workbench.IWorkbench e4Workbench=(org.eclipse.e4.ui.workbench.IWorkbench)PlatformUI.getWorkbench();
  PerspectiveReviewUtil perspectiveReviewUtil=new PerspectiveReviewUtil();
  ContextInjectionFactory.inject(perspectiveReviewUtil,e4Workbench.getApplication().getContext().getActiveLeaf());
  perspectiveReviewUtil.checkPerspectiveDisplayItems();
}
Program: 130182
Project: 130182
Buggy source:
public static String addQuotesWithSpaceFieldForSQLStringForce(String fieldName,String dbType,boolean simple){
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  final String quote=getQuoteByDBType(name);
  boolean isCheck=false;
  String preferenceValue=CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  isCheck=Boolean.parseBoolean(preferenceValue);
  String temp=removeQuotes(fieldName);
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(temp);
  boolean isSqlKeyword=KeywordsValidator.isSqlKeyword(temp,name.getProduct());
  boolean isH2=EDatabaseTypeName.H2 == name;
  if (((!matcher.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name) || isIBMDB2ContainLowerCase(dbType,fieldName)) {
    isCheck=true;
  }
  if (!isCheck && isPSQLSimilar(name) && !EDatabaseTypeName.MYSQL.equals(name)) {
    return fieldName;
  }
  String newFieldName=fieldName;
  newFieldName=TalendQuoteUtils.addQuotesForSQLString(newFieldName,quote,simple);
  return newFieldName;
}

Fixed version (ground truth):
public static String addQuotesWithSpaceFieldForSQLStringForce(String fieldName,String dbType,boolean simple){
  EDatabaseTypeName name=EDatabaseTypeName.getTypeFromDbType(dbType);
  final String quote=getQuoteByDBType(name);
  boolean isCheck=false;
  String preferenceValue=CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.SQL_ADD_QUOTE);
  isCheck=Boolean.parseBoolean(preferenceValue);
  String temp=removeQuotes(fieldName);
  Pattern pattern=Pattern.compile("String_Node_Str");
  Matcher matcher=pattern.matcher(temp);
  boolean isSqlKeyword=KeywordsValidator.isSqlKeyword(temp,name.getProduct());
  boolean isH2=EDatabaseTypeName.H2 == name;
  if (((!matcher.matches() || isSqlKeyword) && !isH2 && EDatabaseTypeName.SAS != name && EDatabaseTypeName.IMPALA != name) || isIBMDB2ContainLowerCase(dbType,fieldName)) {
    isCheck=true;
  }
  if (!isCheck && isPSQLSimilar(name) && !EDatabaseTypeName.MYSQL.equals(name)) {
    return fieldName;
  }
  String newFieldName=fieldName;
  newFieldName=TalendQuoteUtils.addQuotesForSQLString(newFieldName,quote,simple);
  return newFieldName;
}
Program: 130187
Project: 130187
Buggy source:
private void download(final FileDownloader fd){
  Bundle b=new Bundle();
  b.putString("String_Node_Str","String_Node_Str");
  fd.set_notification(TargetActivity.class,b);
  downloaded_file=fd.get_file_name();
  try {
    Log.i("String_Node_Str",fd.download_url);
    progress_bar.setMax(0);
    progress_bar.setProgress(0);
    fd.download(new ProgressUpdateListener(){
      @Override public void on_update(      int downloaded_size){
        Log.i("String_Node_Str",Long.toString(Thread.currentThread().getId()));
        Log.i("String_Node_Str",Integer.toString(downloaded_size));
        Log.i("String_Node_Str",Integer.toString(fd.get_file_size()));
        progress_bar.setMax(fd.get_file_size());
        progress_bar.setProgress(downloaded_size);
        Log.i("String_Node_Str",Integer.toString(progress_bar.getProgress()));
        Log.i("String_Node_Str",Integer.toString(progress_bar.getMax()));
        float num=(float)progress_bar.getProgress() / (float)progress_bar.getMax();
        int result=(int)(num * 100);
        Log.i("String_Node_Str",Integer.toString(result));
        result_view.setText(Integer.toString(result) + "String_Node_Str");
        if (progress_bar.getProgress() == progress_bar.getMax()) {
          downloaded_file_view.setText(stored_dir + "String_Node_Str" + downloaded_file);
        }
      }
    }
);
  }
 catch (  Exception e) {
    handler.obtainMessage(-1).sendToTarget();
    Log.i("String_Node_Str",e.getMessage());
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void download(final FileDownloader fd){
  Bundle b=new Bundle();
  b.putString("String_Node_Str","String_Node_Str");
  fd2.set_notification(TargetActivity.class,b);
  downloaded_file=fd.get_file_name();
  try {
    Log.i("String_Node_Str",fd.download_url);
    progress_bar.setMax(0);
    progress_bar.setProgress(0);
    fd2.download(new ProgressUpdateListener(){
      @Override public void on_update(      int downloaded_size){
        Log.i("String_Node_Str",Long.toString(Thread.currentThread().getId()));
        Log.i("String_Node_Str",Integer.toString(downloaded_size));
        Log.i("String_Node_Str",Integer.toString(fd2.get_file_size()));
        progress_bar.setMax(fd2.get_file_size());
        progress_bar.setProgress(downloaded_size);
        Log.i("String_Node_Str",Integer.toString(progress_bar.getProgress()));
        Log.i("String_Node_Str",Integer.toString(progress_bar.getMax()));
        float num=(float)progress_bar.getProgress() / (float)progress_bar.getMax();
        int result=(int)(num * 100);
        Log.i("String_Node_Str",Integer.toString(result));
        result_view.setText(Integer.toString(result) + "String_Node_Str");
        if (progress_bar.getProgress() == progress_bar.getMax()) {
          downloaded_file_view.setText(stored_dir + "String_Node_Str" + downloaded_file);
        }
      }
    }
);
  }
 catch (  Exception e) {
    handler.obtainMessage(-1).sendToTarget();
    Log.i("String_Node_Str",e.getMessage());
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
}
Program: 130188
Project: 130188
Buggy source:
@Override public void on_update(int downloaded_size){
  Log.i("String_Node_Str",Long.toString(Thread.currentThread().getId()));
  Log.i("String_Node_Str",Integer.toString(downloaded_size));
  Log.i("String_Node_Str",Integer.toString(fd.get_file_size()));
  progress_bar.setMax(fd.get_file_size());
  progress_bar.setProgress(downloaded_size);
  Log.i("String_Node_Str",Integer.toString(progress_bar.getProgress()));
  Log.i("String_Node_Str",Integer.toString(progress_bar.getMax()));
  float num=(float)progress_bar.getProgress() / (float)progress_bar.getMax();
  int result=(int)(num * 100);
  Log.i("String_Node_Str",Integer.toString(result));
  result_view.setText(Integer.toString(result) + "String_Node_Str");
  if (progress_bar.getProgress() == progress_bar.getMax()) {
    downloaded_file_view.setText(stored_dir + "String_Node_Str" + downloaded_file);
  }
}

Fixed version (ground truth):
@Override public void on_update(int downloaded_size){
  Log.i("String_Node_Str",Long.toString(Thread.currentThread().getId()));
  Log.i("String_Node_Str",Integer.toString(downloaded_size));
  Log.i("String_Node_Str",Integer.toString(fd2.get_file_size()));
  progress_bar.setMax(fd2.get_file_size());
  progress_bar.setProgress(downloaded_size);
  Log.i("String_Node_Str",Integer.toString(progress_bar.getProgress()));
  Log.i("String_Node_Str",Integer.toString(progress_bar.getMax()));
  float num=(float)progress_bar.getProgress() / (float)progress_bar.getMax();
  int result=(int)(num * 100);
  Log.i("String_Node_Str",Integer.toString(result));
  result_view.setText(Integer.toString(result) + "String_Node_Str");
  if (progress_bar.getProgress() == progress_bar.getMax()) {
    downloaded_file_view.setText(stored_dir + "String_Node_Str" + downloaded_file);
  }
}
Program: 130189
Project: 130189
Buggy source:
public FileDownloader get_download_store(int obj_id){
  if (download_store_list == null) {
    Log.i("String_Node_Str","String_Node_Str");
    return null;
  }
  for (  FileDownloader item : download_store_list) {
    if (item.obj_id == obj_id) {
      Log.i("String_Node_Str",Integer.toString(item.obj_id));
      Log.i("String_Node_Str",Integer.toString(item.file_size));
      return item;
    }
  }
  return null;
}

Fixed version (ground truth):
public FileDownloader get_download_store(int obj_id){
  if (download_store_list == null) {
    Log.i("String_Node_Str","String_Node_Str");
    return null;
  }
  for (  FileDownloader item : download_store_list) {
    if (item.get_obj_id() == obj_id) {
      Log.i("String_Node_Str",Integer.toString(item.get_obj_id()));
      Log.i("String_Node_Str",Integer.toString(item.file_size));
      return item;
    }
  }
  return null;
}
Program: 130191
Project: 130191
Buggy source:
@Override public int onStartCommand(final Intent intent,int flags,int startId){
  Log.i("String_Node_Str","String_Node_Str");
  FileDownloader download_manager=intent.getParcelableExtra("String_Node_Str");
  Log.i("String_Node_Str",download_manager.get_test());
  Log.i("String_Node_Str",Integer.toString(download_manager.obj_id));
  if (download_manager.should_stop) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  if (download_manager.should_pause) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  FileTaskThread file_task_thread=new FileTaskThread(intent,download_manager,download_manager.notice_id);
  file_task_thread.run();
  should_stop_foreground=intent.getBooleanExtra("String_Node_Str",false);
  if (should_stop_foreground) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  return START_REDELIVER_INTENT;
}

Fixed version (ground truth):
@Override public int onStartCommand(final Intent intent,int flags,int startId){
  Log.i("String_Node_Str","String_Node_Str");
  FileDownloader download_manager=intent.getParcelableExtra("String_Node_Str");
  Log.i("String_Node_Str",download_manager.get_test());
  Log.i("String_Node_Str",Integer.toString(download_manager.get_obj_id()));
  if (download_manager.should_stop) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  if (download_manager.should_pause) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  FileTaskThread file_task_thread=new FileTaskThread(intent,download_manager,download_manager.notice_id);
  file_task_thread.run();
  should_stop_foreground=intent.getBooleanExtra("String_Node_Str",false);
  if (should_stop_foreground) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  return START_REDELIVER_INTENT;
}
Program: 130192
Project: 130192
Buggy source:
private void save_download_manager(FileDownloader fd){
  int obj_id=fd.obj_id;
  FileDownloader download_store=get_download_store(obj_id);
  if (download_store == null) {
    Log.i("String_Node_Str","String_Node_Str");
    download_store_list.add(fd);
  }
 else {
    download_store_list.remove(download_store);
    download_store_list.add(fd);
  }
  if (fd.should_pause) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  if (fd.should_stop) {
    Log.i("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void save_download_manager(FileDownloader fd){
  int obj_id=fd.get_obj_id();
  FileDownloader download_store=get_download_store(obj_id);
  if (download_store == null) {
    Log.i("String_Node_Str","String_Node_Str");
    download_store_list.add(fd);
  }
 else {
    download_store_list.remove(download_store);
    download_store_list.add(fd);
  }
  if (fd.should_pause) {
    Log.i("String_Node_Str","String_Node_Str");
  }
  if (fd.should_stop) {
    Log.i("String_Node_Str","String_Node_Str");
  }
}
Program: 130193
Project: 130193
Buggy source:
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
  if (this.obj_id == 0) {
    this.obj_id=this.hashCode();
    Log.i("String_Node_Str",Integer.toString(obj_id));
  }
}

Fixed version (ground truth):
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
  if (this.obj_id == 0) {
    set_obj_id();
    Log.i("String_Node_Str",Integer.toString(obj_id));
  }
}
Program: 130194
Project: 130194
Buggy source:
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
    return;
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}

Fixed version (ground truth):
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  android.database.sqlite.SQLiteDatabaseLockedException e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
    return;
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}
Program: 130195
Project: 130195
Buggy source:
public FileDownloader get_download_store(int obj_id){
  if (download_store_list == null) {
    Log.i("String_Node_Str","String_Node_Str");
    return null;
  }
  for (  FileDownloader item : download_store_list) {
    if (item.obj_id == obj_id) {
      return item;
    }
  }
  return null;
}

Fixed version (ground truth):
public FileDownloader get_download_store(int obj_id){
  if (download_store_list == null) {
    Log.i("String_Node_Str","String_Node_Str");
    return null;
  }
  for (  FileDownloader item : download_store_list) {
    if (item.obj_id == obj_id) {
      Log.i("String_Node_Str",Integer.toString(item.obj_id));
      Log.i("String_Node_Str",Integer.toString(item.file_size));
      return item;
    }
  }
  return null;
}
Program: 130196
Project: 130196
Buggy source:
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
}

Fixed version (ground truth):
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
  this.obj_id=this.hashCode();
}
Program: 130197
Project: 130197
Buggy source:
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db=db_open_helper.getWritableDatabase();
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}

Fixed version (ground truth):
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db=null;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}
Program: 130198
Project: 130198
Buggy source:
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db=null;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
    return;
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}

Fixed version (ground truth):
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
    return;
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}
Program: 130199
Project: 130199
Buggy source:
public int get_file_size(){
  try {
    Intent download_service=new Intent(context,DownloadService.class);
    context.bindService(download_service,m_connection,Context.BIND_AUTO_CREATE);
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
  return file_size;
}

Fixed version (ground truth):
public int get_file_size(){
  try {
    Log.i("String_Node_Str",Integer.toString(obj_id));
    Intent download_service=new Intent(context,DownloadService.class);
    context.bindService(download_service,m_connection,Context.BIND_AUTO_CREATE);
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
  return file_size;
}
Program: 130200
Project: 130200
Buggy source:
@Override public void onServiceConnected(ComponentName className,IBinder service){
  DownloadService.LocalBinder binder=(DownloadService.LocalBinder)service;
  m_service=binder.getService();
  file_size=m_service.get_download_store(obj_id).file_size;
  m_bound=true;
}

Fixed version (ground truth):
@Override public void onServiceConnected(ComponentName className,IBinder service){
  DownloadService.LocalBinder binder=(DownloadService.LocalBinder)service;
  m_service=binder.getService();
  Log.i("String_Node_Str",Integer.toString(obj_id));
  file_size=m_service.get_download_store(obj_id).file_size;
  m_bound=true;
}
Program: 130201
Project: 130201
Buggy source:
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
  this.obj_id=this.hashCode();
}

Fixed version (ground truth):
public FileDownloader(Context context,String download_url,File file_save_dir,int thread_num){
  this.context=context;
  this.download_url=download_url;
  this.save_file=file_save_dir;
  this.thread_num=thread_num;
  if (this.obj_id == 0) {
    this.obj_id=this.hashCode();
    Log.i("String_Node_Str",Integer.toString(obj_id));
  }
}
Program: 130202
Project: 130202
Buggy source:
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db=null;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}

Fixed version (ground truth):
/** 
 * 实时更新每条线程已经下载的文件长度
 * @param path
 * @param map
 */
public void update(String path,Map<Integer,Integer> map){
  SQLiteDatabase db=null;
  try {
    db=db_open_helper.getWritableDatabase();
  }
 catch (  Exception e) {
    Log.i("String_Node_Str",e.toString());
    e.printStackTrace();
    return;
  }
  if (db == null) {
    return;
  }
  db.beginTransaction();
  try {
    for (    Map.Entry<Integer,Integer> entry : map.entrySet()) {
      db.execSQL("String_Node_Str",new Object[]{entry.getValue(),path,entry.getKey()});
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
  }
  db.close();
}
Program: 130203
Project: 130203
Buggy source:
public DirectoryWatcher(final String... dirs){
  try {
    this.watcher=FileSystems.getDefault().newWatchService();
    this.keys=new HashMap<>();
    registerAll(dirs);
    LOGGER.info("String_Node_Str",dirs);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public DirectoryWatcher(final String... dirs){
  try {
    this.watcher=FileSystems.getDefault().newWatchService();
    this.keys=new HashMap<>();
    for (    String dir : dirs) {
      registerAll(Paths.get(dir));
    }
    LOGGER.info("String_Node_Str",dirs);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 130204
Project: 130204
Buggy source:
@Override public void run(){
  while (true) {
    try {
      WatchKey key=watcher.take();
      Path dir=keys.get(key);
      for (      WatchEvent<?> event : key.pollEvents()) {
        WatchEvent<Path> ev=cast(event);
        Path child=dir.resolve(ev.context());
        r.run();
        if (event.kind() == ENTRY_CREATE) {
          if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
            registerAll(child);
          }
        }
      }
      boolean valid=key.reset();
      if (!valid) {
        keys.remove(key);
        if (keys.isEmpty()) {
          break;
        }
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    try {
      WatchKey key=watcher.take();
      Path dir=keys.get(key);
      for (      WatchEvent<?> event : key.pollEvents()) {
        WatchEvent<Path> ev=cast(event);
        Path child=dir.resolve(ev.context());
        if (child.toFile().isFile()) {
          LOGGER.info("String_Node_Str");
          try {
            r.run();
          }
 catch (          Exception e) {
            LOGGER.error("String_Node_Str",e);
          }
          if (event.kind() == ENTRY_CREATE) {
            if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
              registerAll(child);
            }
          }
        }
        boolean valid=key.reset();
        if (!valid) {
          keys.remove(key);
          if (keys.isEmpty()) {
            break;
          }
        }
      }
    }
 catch (    Exception ignored) {
    }
  }
}