From 369139211d1f5c58c6ea9d4f7f5e3ed5f61c16ea Mon Sep 17 00:00:00 2001 From: oblonski Date: Tue, 28 Nov 2017 15:47:33 +0100 Subject: [PATCH] refine error messages --- .../jsprit/core/problem/vehicle/VehicleImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java index f77f7b9c..809f2adf 100644 --- a/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java +++ b/jsprit-core/src/main/java/com/graphhopper/jsprit/core/problem/vehicle/VehicleImpl.java @@ -145,7 +145,7 @@ public class VehicleImpl extends AbstractVehicle { * @throws IllegalArgumentException if type is null */ public Builder setType(VehicleType type) { - if (type == null) throw new IllegalArgumentException("type cannot be null."); + if (type == null) throw new IllegalArgumentException("Vehicle type must not be null."); this.type = type; return this; } @@ -213,7 +213,7 @@ public class VehicleImpl extends AbstractVehicle { */ public Builder setEarliestStart(double earliest_startTime) { if (earliest_startTime < 0) - throw new IllegalArgumentException("earliest start of vehicle " + id + " must not be negative"); + throw new IllegalArgumentException("The earliest start time of vehicle " + id + " must not be negative."); this.earliestStart = earliest_startTime; return this; } @@ -226,7 +226,7 @@ public class VehicleImpl extends AbstractVehicle { */ public Builder setLatestArrival(double latest_arrTime) { if (latest_arrTime < 0) - throw new IllegalArgumentException("latest arrival time of vehicle " + id + " must not be negative"); + throw new IllegalArgumentException("The latest arrival time of vehicle " + id + " must not be negative."); this.latestArrival = latest_arrTime; return this; } @@ -254,17 +254,17 @@ public class VehicleImpl extends AbstractVehicle { */ public VehicleImpl build() { if (latestArrival < earliestStart) - throw new IllegalArgumentException("latest arrival of vehicle " + id + " must not be smaller than its start time"); + throw new IllegalArgumentException("The latest arrival time of vehicle " + id + " must not be smaller than its start time."); if (startLocation != null && endLocation != null) { if (!startLocation.getId().equals(endLocation.getId()) && !returnToDepot) - throw new IllegalArgumentException("this must not be. you specified both endLocationId and open-routes. this is contradictory.
" + - "if you set endLocation, returnToDepot must be true. if returnToDepot is false, endLocationCoord must not be specified."); + throw new IllegalArgumentException("You specified both the end location and that the vehicle " + id + " does not need to return to its end location. This must not be. " + + "Either specify end location and return to depot or leave end location unspecified."); } if (startLocation != null && endLocation == null) { endLocation = startLocation; } if (startLocation == null && endLocation == null) - throw new IllegalArgumentException("vehicle requires startLocation. but neither locationId nor locationCoord nor startLocationId nor startLocationCoord has been set"); + throw new IllegalArgumentException("Every vehicle requires a start location, but vehicle " + id + " does not have one."); skills = skillBuilder.build(); return new VehicleImpl(this); }