Program: 116889
Project: 116889
Buggy source:
/** 
 * Increase the priority of an overrideId
 * @param overrideId ID of override
 * @param pathId ID of path containing override
 * @param clientUUID UUID of client
 */
public void increasePriority(int overrideId,int pathId,String clientUUID){
  logger.info("String_Node_Str");
  int origPriority=-1;
  int newPriority=-1;
  PreparedStatement statement=null;
  ResultSet results=null;
  try (Connection sqlConnection=sqlService.getConnection()){
    results=null;
    statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PATH_ID+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_CLIENT_UUID+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY);
    statement.setInt(1,pathId);
    statement.setString(2,clientUUID);
    results=statement.executeQuery();
    while (results.next()) {
      if (results.getInt(Constants.ENABLED_OVERRIDES_OVERRIDE_ID) == overrideId) {
        origPriority=results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
        break;
      }
 else {
        newPriority=results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (results != null) {
        results.close();
      }
    }
 catch (    Exception e) {
    }
    try {
      if (statement != null) {
        statement.close();
      }
    }
 catch (    Exception e) {
    }
  }
  try (Connection sqlConnection=sqlService.getConnection()){
    if (origPriority != -1 && newPriority != -1) {
      statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PATH_ID+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_CLIENT_UUID+ "String_Node_Str");
      statement.setInt(1,origPriority);
      statement.setInt(2,newPriority);
      statement.setInt(3,pathId);
      statement.setString(4,clientUUID);
      statement.executeUpdate();
      statement.close();
      statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_OVERRIDE_ID+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PATH_ID+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_CLIENT_UUID+ "String_Node_Str");
      statement.setInt(1,newPriority);
      statement.setInt(2,overrideId);
      statement.setInt(3,pathId);
      statement.setString(4,clientUUID);
      statement.executeUpdate();
    }
  }
 catch (  Exception e) {
  }
 finally {
    try {
      if (statement != null) {
        statement.close();
      }
    }
 catch (    Exception e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Increase the priority of an overrideId
 * @param overrideId ID of override
 * @param pathId ID of path containing override
 * @param clientUUID UUID of client
 */
public void increasePriority(int overrideId,int ordinal,int pathId,String clientUUID){
  logger.info("String_Node_Str");
  int origPriority=-1;
  int newPriority=-1;
  int origId=0;
  int newId=0;
  PreparedStatement statement=null;
  ResultSet results=null;
  try (Connection sqlConnection=sqlService.getConnection()){
    results=null;
    statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PATH_ID+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_CLIENT_UUID+ "String_Node_Str"+ "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY);
    statement.setInt(1,pathId);
    statement.setString(2,clientUUID);
    results=statement.executeQuery();
    int ordinalCount=0;
    while (results.next()) {
      if (results.getInt(Constants.ENABLED_OVERRIDES_OVERRIDE_ID) == overrideId) {
        ordinalCount++;
        if (ordinalCount == ordinal) {
          origPriority=results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
          origId=results.getInt(Constants.GENERIC_ID);
          break;
        }
      }
      newPriority=results.getInt(Constants.ENABLED_OVERRIDES_PRIORITY);
      newId=results.getInt(Constants.GENERIC_ID);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (results != null) {
        results.close();
      }
    }
 catch (    Exception e) {
    }
    try {
      if (statement != null) {
        statement.close();
      }
    }
 catch (    Exception e) {
    }
  }
  try (Connection sqlConnection=sqlService.getConnection()){
    if (origPriority != -1 && newPriority != -1) {
      statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_ID+ "String_Node_Str");
      statement.setInt(1,origPriority);
      statement.setInt(2,newId);
      statement.executeUpdate();
      statement.close();
      statement=sqlConnection.prepareStatement("String_Node_Str" + Constants.DB_TABLE_ENABLED_OVERRIDE + "String_Node_Str"+ Constants.ENABLED_OVERRIDES_PRIORITY+ "String_Node_Str"+ "String_Node_Str"+ Constants.GENERIC_ID+ "String_Node_Str");
      statement.setInt(1,newPriority);
      statement.setInt(2,origId);
      statement.executeUpdate();
    }
  }
 catch (  Exception e) {
  }
 finally {
    try {
      if (statement != null) {
        statement.close();
      }
    }
 catch (    Exception e) {
    }
  }
}