Program: 166960
Project: 166960
Buggy source:
@SuppressWarnings("String_Node_Str") private void loadSqlgSchemaFromInformationSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    DatabaseMetaData metadata=conn.getMetaData();
    String catalog=null;
    String schemaPattern=null;
    String[] types=new String[]{"String_Node_Str"};
    try (ResultSet schemaRs=metadata.getSchemas()){
      while (schemaRs.next()) {
        String schema=schemaRs.getString(1);
        if (schema.equals(SQLG_SCHEMA) || this.sqlDialect.getDefaultSchemas().contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        TopologyManager.addSchema(this.sqlgGraph,schema);
      }
    }
     try (ResultSet vertexRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (vertexRs.next()) {
        String schema=vertexRs.getString(2);
        String table=vertexRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<String,PropertyType> columns=new ConcurrentHashMap<>();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        List<Triple<String,Integer,String>> metaDatas=new ArrayList<>();
        while (columnsRs.next()) {
          String columnName=columnsRs.getString(4);
          int columnType=columnsRs.getInt(5);
          String typeName=columnsRs.getString("String_Node_Str");
          metaDatas.add(Triple.of(columnName,columnType,typeName));
        }
        columnsRs.close();
        ListIterator<Triple<String,Integer,String>> metaDataIter=metaDatas.listIterator();
        while (metaDataIter.hasNext()) {
          Triple<String,Integer,String> tripple=metaDataIter.next();
          String columnName=tripple.getLeft();
          int columnType=tripple.getMiddle();
          String typeName=tripple.getRight();
          if (!columnName.equals(SchemaManager.ID)) {
            extractProperty(schema,table,columnName,columnType,typeName,columns,metaDataIter);
          }
        }
        TopologyManager.addVertexLabel(this.sqlgGraph,schema,table.substring(SchemaManager.VERTEX_PREFIX.length()),columns);
      }
    }
     try (ResultSet edgeRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (edgeRs.next()) {
        String schema=edgeRs.getString(2);
        String table=edgeRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<SchemaTable,MutablePair<SchemaTable,SchemaTable>> inOutSchemaTableMap=new HashMap<>();
        Map<String,PropertyType> columns=Collections.emptyMap();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        SchemaTable edgeSchemaTable=SchemaTable.of(schema,table);
        boolean edgeAdded=false;
        while (columnsRs.next()) {
          String column=columnsRs.getString(4);
          if (table.startsWith(EDGE_PREFIX) && (column.endsWith(SchemaManager.IN_VERTEX_COLUMN_END) || column.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END))) {
            String[] split=column.split("String_Node_Str");
            SchemaTable foreignKey=SchemaTable.of(split[0],split[1]);
            if (column.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
              SchemaTable schemaTable=SchemaTable.of(split[0],split[1].substring(0,split[1].length() - SchemaManager.IN_VERTEX_COLUMN_END.length()));
              if (inOutSchemaTableMap.containsKey(edgeSchemaTable)) {
                MutablePair<SchemaTable,SchemaTable> inSchemaTable=inOutSchemaTableMap.get(edgeSchemaTable);
                if (inSchemaTable.getLeft() == null) {
                  inSchemaTable.setLeft(schemaTable);
                }
 else {
                  TopologyManager.addLabelToEdge(this.sqlgGraph,schema,table,true,foreignKey);
                }
              }
 else {
                inOutSchemaTableMap.put(edgeSchemaTable,MutablePair.of(schemaTable,null));
              }
            }
 else             if (column.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
              SchemaTable schemaTable=SchemaTable.of(split[0],split[1].substring(0,split[1].length() - SchemaManager.OUT_VERTEX_COLUMN_END.length()));
              if (inOutSchemaTableMap.containsKey(edgeSchemaTable)) {
                MutablePair<SchemaTable,SchemaTable> outSchemaTable=inOutSchemaTableMap.get(edgeSchemaTable);
                if (outSchemaTable.getRight() == null) {
                  outSchemaTable.setRight(schemaTable);
                }
 else {
                  TopologyManager.addLabelToEdge(this.sqlgGraph,schema,table,false,foreignKey);
                }
              }
 else {
                inOutSchemaTableMap.put(edgeSchemaTable,MutablePair.of(null,schemaTable));
              }
            }
            MutablePair<SchemaTable,SchemaTable> inOutLabels=inOutSchemaTableMap.get(edgeSchemaTable);
            if (!edgeAdded && inOutLabels.getLeft() != null && inOutLabels.getRight() != null) {
              TopologyManager.addEdgeLabel(this.sqlgGraph,schema,table,inOutLabels.getRight(),inOutLabels.getLeft(),columns);
              edgeAdded=true;
            }
          }
        }
      }
    }
     try (ResultSet edgeRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (edgeRs.next()) {
        String schema=edgeRs.getString(2);
        String table=edgeRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<String,PropertyType> columns=new HashMap<>();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        List<Triple<String,Integer,String>> metaDatas=new ArrayList<>();
        while (columnsRs.next()) {
          String columnName=columnsRs.getString(4);
          int columnType=columnsRs.getInt(5);
          String typeName=columnsRs.getString("String_Node_Str");
          metaDatas.add(Triple.of(columnName,columnType,typeName));
        }
        columnsRs.close();
        ListIterator<Triple<String,Integer,String>> metaDataIter=metaDatas.listIterator();
        while (metaDataIter.hasNext()) {
          Triple<String,Integer,String> tripple=metaDataIter.next();
          String columnName=tripple.getLeft();
          String typeName=tripple.getRight();
          int columnType=tripple.getMiddle();
          if (!columnName.equals(SchemaManager.ID)) {
            extractProperty(schema,table,columnName,columnType,typeName,columns,metaDataIter);
          }
        }
        TopologyManager.addEdgeColumn(this.sqlgGraph,schema,table,columns);
      }
    }
   }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void loadSqlgSchemaFromInformationSchema(){
  Connection conn=this.sqlgGraph.tx().getConnection();
  try {
    DatabaseMetaData metadata=conn.getMetaData();
    String catalog=null;
    String schemaPattern=null;
    String[] types=new String[]{"String_Node_Str"};
    try (ResultSet schemaRs=metadata.getSchemas()){
      while (schemaRs.next()) {
        String schema=schemaRs.getString(1);
        if (schema.equals(SQLG_SCHEMA) || this.sqlDialect.getDefaultSchemas().contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        TopologyManager.addSchema(this.sqlgGraph,schema);
      }
    }
     try (ResultSet vertexRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (vertexRs.next()) {
        String schema=vertexRs.getString(2);
        String table=vertexRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<String,PropertyType> columns=new ConcurrentHashMap<>();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        List<Triple<String,Integer,String>> metaDatas=new ArrayList<>();
        while (columnsRs.next()) {
          String columnName=columnsRs.getString(4);
          int columnType=columnsRs.getInt(5);
          String typeName=columnsRs.getString("String_Node_Str");
          metaDatas.add(Triple.of(columnName,columnType,typeName));
        }
        columnsRs.close();
        ListIterator<Triple<String,Integer,String>> metaDataIter=metaDatas.listIterator();
        while (metaDataIter.hasNext()) {
          Triple<String,Integer,String> tripple=metaDataIter.next();
          String columnName=tripple.getLeft();
          int columnType=tripple.getMiddle();
          String typeName=tripple.getRight();
          if (!columnName.equals(SchemaManager.ID)) {
            extractProperty(schema,table,columnName,columnType,typeName,columns,metaDataIter);
          }
        }
        String label=table.substring(SchemaManager.VERTEX_PREFIX.length());
        TopologyManager.addVertexLabel(this.sqlgGraph,schema,label,columns);
        extractIndices(metadata,catalog,schema,table,label,true);
      }
    }
     try (ResultSet edgeRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (edgeRs.next()) {
        String schema=edgeRs.getString(2);
        String table=edgeRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<SchemaTable,MutablePair<SchemaTable,SchemaTable>> inOutSchemaTableMap=new HashMap<>();
        Map<String,PropertyType> columns=Collections.emptyMap();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        SchemaTable edgeSchemaTable=SchemaTable.of(schema,table);
        boolean edgeAdded=false;
        while (columnsRs.next()) {
          String column=columnsRs.getString(4);
          if (table.startsWith(EDGE_PREFIX) && (column.endsWith(SchemaManager.IN_VERTEX_COLUMN_END) || column.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END))) {
            String[] split=column.split("String_Node_Str");
            SchemaTable foreignKey=SchemaTable.of(split[0],split[1]);
            if (column.endsWith(SchemaManager.IN_VERTEX_COLUMN_END)) {
              SchemaTable schemaTable=SchemaTable.of(split[0],split[1].substring(0,split[1].length() - SchemaManager.IN_VERTEX_COLUMN_END.length()));
              if (inOutSchemaTableMap.containsKey(edgeSchemaTable)) {
                MutablePair<SchemaTable,SchemaTable> inSchemaTable=inOutSchemaTableMap.get(edgeSchemaTable);
                if (inSchemaTable.getLeft() == null) {
                  inSchemaTable.setLeft(schemaTable);
                }
 else {
                  TopologyManager.addLabelToEdge(this.sqlgGraph,schema,table,true,foreignKey);
                }
              }
 else {
                inOutSchemaTableMap.put(edgeSchemaTable,MutablePair.of(schemaTable,null));
              }
            }
 else             if (column.endsWith(SchemaManager.OUT_VERTEX_COLUMN_END)) {
              SchemaTable schemaTable=SchemaTable.of(split[0],split[1].substring(0,split[1].length() - SchemaManager.OUT_VERTEX_COLUMN_END.length()));
              if (inOutSchemaTableMap.containsKey(edgeSchemaTable)) {
                MutablePair<SchemaTable,SchemaTable> outSchemaTable=inOutSchemaTableMap.get(edgeSchemaTable);
                if (outSchemaTable.getRight() == null) {
                  outSchemaTable.setRight(schemaTable);
                }
 else {
                  TopologyManager.addLabelToEdge(this.sqlgGraph,schema,table,false,foreignKey);
                }
              }
 else {
                inOutSchemaTableMap.put(edgeSchemaTable,MutablePair.of(null,schemaTable));
              }
            }
            MutablePair<SchemaTable,SchemaTable> inOutLabels=inOutSchemaTableMap.get(edgeSchemaTable);
            if (!edgeAdded && inOutLabels.getLeft() != null && inOutLabels.getRight() != null) {
              TopologyManager.addEdgeLabel(this.sqlgGraph,schema,table,inOutLabels.getRight(),inOutLabels.getLeft(),columns);
              edgeAdded=true;
            }
          }
        }
      }
    }
     try (ResultSet edgeRs=metadata.getTables(catalog,schemaPattern,"String_Node_Str",types)){
      while (edgeRs.next()) {
        String schema=edgeRs.getString(2);
        String table=edgeRs.getString(3);
        Set<String> schemasToIgnore=new HashSet<>(this.sqlDialect.getDefaultSchemas());
        schemasToIgnore.remove(this.sqlDialect.getPublicSchema());
        if (schema.equals(SQLG_SCHEMA) || schemasToIgnore.contains(schema) || this.sqlDialect.getGisSchemas().contains(schema)) {
          continue;
        }
        if (this.sqlDialect.getSpacialRefTable().contains(table)) {
          continue;
        }
        Map<String,PropertyType> columns=new HashMap<>();
        ResultSet columnsRs=metadata.getColumns(catalog,schema,table,null);
        List<Triple<String,Integer,String>> metaDatas=new ArrayList<>();
        while (columnsRs.next()) {
          String columnName=columnsRs.getString(4);
          int columnType=columnsRs.getInt(5);
          String typeName=columnsRs.getString("String_Node_Str");
          metaDatas.add(Triple.of(columnName,columnType,typeName));
        }
        columnsRs.close();
        ListIterator<Triple<String,Integer,String>> metaDataIter=metaDatas.listIterator();
        while (metaDataIter.hasNext()) {
          Triple<String,Integer,String> tripple=metaDataIter.next();
          String columnName=tripple.getLeft();
          String typeName=tripple.getRight();
          int columnType=tripple.getMiddle();
          if (!columnName.equals(SchemaManager.ID)) {
            extractProperty(schema,table,columnName,columnType,typeName,columns,metaDataIter);
          }
        }
        TopologyManager.addEdgeColumn(this.sqlgGraph,schema,table,columns);
        String label=table.substring(SchemaManager.EDGE_PREFIX.length());
        extractIndices(metadata,catalog,schema,table,label,false);
      }
    }
   }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}