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:
parent
f6d06c0b48
commit
427bca13cc
1 changed files with 6 additions and 6 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* 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
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 3.0 of the License, or (at your option) any later version.
|
* version 3.0 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This library is distributed in the hope that it will be useful,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Lesser General Public License for more details.
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
@ -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]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue