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

throw exception if vehicle id is null

This commit is contained in:
oblonski 2017-12-11 13:29:44 +01:00
parent b610626b1d
commit f218b9a738
No known key found for this signature in database
GPG key ID: 179DE487285680D1

View file

@ -135,6 +135,7 @@ public class VehicleImpl extends AbstractVehicle {
private Builder(String id) {
super();
this.id = id;
if (id == null) throw new IllegalArgumentException("Vehicle id must not be null.");
}
/**
@ -196,6 +197,8 @@ public class VehicleImpl extends AbstractVehicle {
* @return start location
*/
public Builder setStartLocation(Location startLocation) {
if (startLocation == null)
throw new IllegalArgumentException("Start location of vehicle " + id + " must not be null.");
this.startLocation = startLocation;
return this;
}
@ -232,6 +235,7 @@ public class VehicleImpl extends AbstractVehicle {
}
public Builder addSkill(String skill) {
if (skill == null) throw new IllegalArgumentException("Skill of vehicle " + id + " must not be null");
skillBuilder.addSkill(skill);
return this;
}