1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

add check to prevent LuiShenReader to throw IndexOutOfBoundsException when reading file ending with empty lines

This commit is contained in:
oblonski 2014-09-16 10:35:54 +02:00
parent f6d06c0b48
commit 427bca13cc

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (C) 2013 Stefan Schroeder * Copyright (C) 2014 Stefan Schroeder
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -45,7 +45,6 @@ public class LuiShenReader {
public LuiShenReader(VehicleRoutingProblem.Builder vrpBuilder) { public LuiShenReader(VehicleRoutingProblem.Builder vrpBuilder) {
super(); super();
this.vrpBuilder = vrpBuilder; this.vrpBuilder = vrpBuilder;
// this.vrpBuilder.setFleetComposition(FleetComposition.HETEROGENEOUS);
} }
/** /**
@ -76,6 +75,7 @@ public class LuiShenReader {
String[] tokens = line.split(" +"); String[] tokens = line.split(" +");
counter++; counter++;
if(counter > 9){ if(counter > 9){
if(tokens.length < 7) continue;
Coordinate coord = makeCoord(tokens[1],tokens[2]); Coordinate coord = makeCoord(tokens[1],tokens[2]);
String customerId = tokens[0]; String customerId = tokens[0];
int demand = Integer.parseInt(tokens[3]); int demand = Integer.parseInt(tokens[3]);