Program: 89690
Project: 89690
Buggy source:
@Override public String getCurrentVersion(){
  Connection conn=null;
  try {
    s_logger.debug("String_Node_Str");
    conn=Transaction.getStandaloneConnection();
    PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
    ResultSet rs=pstmt.executeQuery();
    if (!rs.next()) {
      rs.close();
      pstmt.close();
      pstmt=conn.prepareStatement("String_Node_Str");
      rs=pstmt.executeQuery();
      if (!rs.next()) {
        rs.close();
        pstmt.close();
        pstmt=conn.prepareStatement("String_Node_Str");
        try {
          pstmt.executeQuery();
          return "String_Node_Str";
        }
 catch (        SQLException e) {
          s_logger.debug("String_Node_Str");
          s_logger.debug("String_Node_Str");
          return "String_Node_Str";
        }
 finally {
          pstmt.close();
        }
      }
 else {
        rs.close();
        pstmt.close();
        s_logger.debug("String_Node_Str");
        pstmt=conn.prepareStatement("String_Node_Str");
        try {
          pstmt.executeQuery();
          return "String_Node_Str";
        }
 catch (        SQLException e) {
          s_logger.debug("String_Node_Str");
          return "String_Node_Str";
        }
 finally {
          pstmt.close();
        }
      }
    }
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      conn.close();
    }
 catch (    SQLException e) {
    }
  }
  SearchCriteria<String> sc=CurrentVersionSearch.create();
  sc.setParameters("String_Node_Str",Step.Complete);
  Filter filter=new Filter(VersionVO.class,"String_Node_Str",false,0l,1l);
  List<String> vers=customSearch(sc,filter);
  return vers.get(0);
}

Fixed version (ground truth):
@Override public String getCurrentVersion(){
  Connection conn=null;
  try {
    s_logger.debug("String_Node_Str");
    conn=Transaction.getStandaloneConnection();
    PreparedStatement pstmt=conn.prepareStatement("String_Node_Str");
    ResultSet rs=pstmt.executeQuery();
    if (!rs.next()) {
      rs.close();
      pstmt.close();
      pstmt=conn.prepareStatement("String_Node_Str");
      rs=pstmt.executeQuery();
      if (!rs.next()) {
        rs.close();
        pstmt.close();
        pstmt=conn.prepareStatement("String_Node_Str");
        try {
          pstmt.executeQuery();
          return "String_Node_Str";
        }
 catch (        SQLException e) {
          s_logger.debug("String_Node_Str");
          s_logger.debug("String_Node_Str");
          return "String_Node_Str";
        }
 finally {
          pstmt.close();
        }
      }
 else {
        rs.close();
        pstmt.close();
        s_logger.debug("String_Node_Str");
        return "String_Node_Str";
      }
    }
    SearchCriteria<String> sc=CurrentVersionSearch.create();
    sc.setParameters("String_Node_Str",Step.Complete);
    Filter filter=new Filter(VersionVO.class,"String_Node_Str",false,0l,1l);
    List<String> upgradedVersions=customSearch(sc,filter);
    if (upgradedVersions.isEmpty()) {
      filter=new Filter(VersionVO.class,"String_Node_Str",false,0l,1l);
      sc=CurrentVersionSearch.create();
      List<String> vers=customSearch(sc,filter);
      if (!vers.isEmpty()) {
        throw new CloudRuntimeException("String_Node_Str");
      }
      try {
        s_logger.debug("String_Node_Str");
        pstmt=conn.prepareStatement("String_Node_Str");
        rs=pstmt.executeQuery();
        if (!rs.next()) {
          throw new CloudRuntimeException("String_Node_Str");
        }
 else {
          pstmt=conn.prepareStatement("String_Node_Str");
          pstmt.executeQuery();
          throw new CloudRuntimeException("String_Node_Str");
        }
      }
 catch (      SQLException e) {
        s_logger.debug("String_Node_Str");
        return "String_Node_Str";
      }
 finally {
        rs.close();
        pstmt.close();
      }
    }
 else {
      return upgradedVersions.get(0);
    }
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      conn.close();
    }
 catch (    SQLException e) {
    }
  }
}