Program: 112431
Project: 112431
Buggy source:
@Test public void testIndexWithNullableDateCol() throws Exception {
  String tableName="String_Node_Str" + generateUniqueName();
  String indexName="String_Node_Str" + generateUniqueName();
  String fullTableName=SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME,tableName);
  String fullIndexName=SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME,indexName);
  Properties props=PropertiesUtil.deepCopy(TEST_PROPERTIES);
  try (Connection conn=DriverManager.getConnection(getUrl(),props)){
    conn.setAutoCommit(false);
    Date date=new Date(System.currentTimeMillis());
    TestUtil.createMultiCFTestTable(conn,fullTableName,tableDDLOptions);
    populateMultiCFTestTable(fullTableName,date);
    String ddl="String_Node_Str" + (localIndex ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ indexName+ "String_Node_Str"+ fullTableName+ "String_Node_Str";
    PreparedStatement stmt=conn.prepareStatement(ddl);
    stmt.execute();
    String query="String_Node_Str" + fullTableName;
    ResultSet rs=conn.createStatement().executeQuery("String_Node_Str" + query);
    if (localIndex) {
      assertEquals("String_Node_Str" + fullTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
 else {
      assertEquals("String_Node_Str" + fullIndexName + "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
    rs=conn.createStatement().executeQuery(query);
    assertTrue(rs.next());
    assertEquals(2,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(1,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(3,rs.getInt(1));
    assertFalse(rs.next());
    query="String_Node_Str" + fullTableName + "String_Node_Str";
    rs=conn.createStatement().executeQuery("String_Node_Str" + query);
    if (localIndex) {
      assertEquals("String_Node_Str" + fullTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
 else {
      assertEquals("String_Node_Str" + fullIndexName + "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
    rs=conn.createStatement().executeQuery(query);
    assertTrue(rs.next());
    assertEquals(date,rs.getDate(1));
    assertTrue(rs.next());
    assertEquals(new Date(date.getTime() + MILLIS_IN_DAY),rs.getDate(1));
    assertTrue(rs.next());
    assertEquals(new Date(date.getTime() + 2 * MILLIS_IN_DAY),rs.getDate(1));
    assertFalse(rs.next());
  }
 }

Fixed version (ground truth):
@Test public void testIndexWithNullableDateCol() throws Exception {
  String tableName="String_Node_Str" + generateUniqueName();
  String indexName="String_Node_Str" + generateUniqueName();
  String fullTableName=SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME,tableName);
  String fullIndexName=SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME,indexName);
  Properties props=PropertiesUtil.deepCopy(TEST_PROPERTIES);
  try (Connection conn=DriverManager.getConnection(getUrl(),props)){
    conn.setAutoCommit(false);
    Date date=new Date(System.currentTimeMillis());
    TestUtil.createMultiCFTestTable(conn,fullTableName,tableDDLOptions);
    populateMultiCFTestTable(fullTableName,date);
    String ddl="String_Node_Str" + (localIndex ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str"+ indexName+ "String_Node_Str"+ fullTableName+ "String_Node_Str";
    conn.createStatement().execute(ddl);
    String query="String_Node_Str" + fullTableName;
    ResultSet rs=conn.createStatement().executeQuery("String_Node_Str" + query);
    if (localIndex) {
      assertEquals("String_Node_Str" + fullTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
 else {
      assertEquals("String_Node_Str" + fullIndexName + "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
    rs=conn.createStatement().executeQuery(query);
    assertTrue(rs.next());
    assertEquals(2,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(1,rs.getInt(1));
    assertTrue(rs.next());
    assertEquals(3,rs.getInt(1));
    assertFalse(rs.next());
    query="String_Node_Str" + fullTableName + "String_Node_Str";
    rs=conn.createStatement().executeQuery("String_Node_Str" + query);
    if (localIndex) {
      assertEquals("String_Node_Str" + fullTableName + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
 else {
      assertEquals("String_Node_Str" + fullIndexName + "String_Node_Str"+ "String_Node_Str",QueryUtil.getExplainPlan(rs));
    }
    rs=conn.createStatement().executeQuery(query);
    assertTrue(rs.next());
    assertEquals(date,rs.getDate(1));
    assertTrue(rs.next());
    assertEquals(new Date(date.getTime() + MILLIS_IN_DAY),rs.getDate(1));
    assertTrue(rs.next());
    assertEquals(new Date(date.getTime() + 2 * MILLIS_IN_DAY),rs.getDate(1));
    assertFalse(rs.next());
  }
 }