Program: 112418
Project: 112418
Buggy source:
@Test public void testExecuteStatements() throws Exception {
  String tenantId=getOrganizationId();
  String tableName=initATableValues(tenantId,getDefaultSplits(tenantId),getUrl());
  String ptsdbTableName=generateUniqueName();
  String statements="String_Node_Str" + tableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ tableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str";
  Date now=new Date(System.currentTimeMillis());
  Connection conn=DriverManager.getConnection(getUrl());
  conn.setAutoCommit(true);
  List<Object> binds=Arrays.<Object>asList("String_Node_Str","String_Node_Str","String_Node_Str",6);
  int nStatements=PhoenixRuntime.executeStatements(conn,new StringReader(statements),binds);
  assertEquals(7,nStatements);
  Date then=new Date(System.currentTimeMillis() + QueryConstants.MILLIS_IN_DAY);
  String query="String_Node_Str" + ptsdbTableName + "String_Node_Str";
  PreparedStatement statement=conn.prepareStatement(query);
  ResultSet rs=statement.executeQuery();
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW6,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertEquals(null,rs.getBigDecimal(4));
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW7,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(70).compareTo(rs.getBigDecimal(4)) == 0);
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW8,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(60).compareTo(rs.getBigDecimal(4)) == 0);
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW9,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(50).compareTo(rs.getBigDecimal(4)) == 0);
  assertFalse(rs.next());
  conn.close();
}

Fixed version (ground truth):
@Test public void testExecuteStatements() throws Exception {
  String tenantId=getOrganizationId();
  String tableName=initATableValues(tenantId,getDefaultSplits(tenantId),getUrl());
  String ptsdbTableName=generateUniqueName();
  String statements="String_Node_Str" + tableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ tableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str"+ "String_Node_Str"+ ptsdbTableName+ "String_Node_Str";
  Date now=new Date(System.currentTimeMillis());
  Connection conn=DriverManager.getConnection(getUrl());
  conn.setAutoCommit(true);
  List<Object> binds=Arrays.<Object>asList(6);
  int nStatements=PhoenixRuntime.executeStatements(conn,new StringReader(statements),binds);
  assertEquals(7,nStatements);
  Date then=new Date(System.currentTimeMillis() + QueryConstants.MILLIS_IN_DAY);
  String query="String_Node_Str" + ptsdbTableName + "String_Node_Str";
  PreparedStatement statement=conn.prepareStatement(query);
  ResultSet rs=statement.executeQuery();
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW6,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertEquals(null,rs.getBigDecimal(4));
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW7,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(70).compareTo(rs.getBigDecimal(4)) == 0);
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW8,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(60).compareTo(rs.getBigDecimal(4)) == 0);
  assertTrue(rs.next());
  assertEquals(null,rs.getString(1));
  assertEquals(ROW9,rs.getString(2));
  assertTrue(rs.getDate(3).after(now) && rs.getDate(3).before(then));
  assertTrue(BigDecimal.valueOf(50).compareTo(rs.getBigDecimal(4)) == 0);
  assertFalse(rs.next());
  conn.close();
}