0

I have a problem running this chunk of code, the code is read from a csv file, and for each line in the file, there is two vertexes and an edge, so I'm using this file to construct a graph, but I can easily create vertexes, and when it comes to create edge, the system gives me this exception:

io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.kryo.KryoException: java.lang.NegativeArraySizeException

code

Graph graph = EmptyGraph.instance();
GraphTraversalSource g = graph.traversal().withRemote("remote-graph.properties");
Iterator<String> lineIt = FileUtils.lineIterator(new File(args[0]));
while (lineIt.hasNext()) {
    String line = lineIt.next();
    String[] cols = line.split(",");
    System.out.println(cols[0]);
    System.out.println(cols.length);
    g.addV().property("poiId", cols[0]).property("name", cols[1]).property("type", cols[2]).as("a").addV()
            .property("poiId", cols[3]).property("name", cols[4]).property("type", cols[5]).as("b").addE("hehe").from("a").to("b").next();
}
g.close();
Morteza Asadi
  • 1,819
  • 2
  • 22
  • 39
Gao
  • 912
  • 6
  • 16

0 Answers0