From 8066a353d9c80be5ccdb61f5f3af5ec2f5910b42 Mon Sep 17 00:00:00 2001 From: oblonski <4sschroeder@gmail.com> Date: Thu, 15 May 2014 12:58:06 +0200 Subject: [PATCH] added NoSolutionFoundException to improve exception handling NoSolutionFoundException is still an IllegalStateException --- .../core/algorithm/recreate/BestInsertion.java | 2 +- .../recreate/NoSolutionFoundException.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 jsprit-core/src/main/java/jsprit/core/algorithm/recreate/NoSolutionFoundException.java diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/BestInsertion.java b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/BestInsertion.java index 10cea48e..a37a52aa 100644 --- a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/BestInsertion.java +++ b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/BestInsertion.java @@ -132,7 +132,7 @@ final class BestInsertion implements InsertionStrategy{ VehicleRoute newRoute = VehicleRoute.emptyRoute(); InsertionData bestI = bestInsertionCostCalculator.getInsertionData(newRoute, unassignedJob, NO_NEW_VEHICLE_YET, NO_NEW_DEPARTURE_TIME_YET, NO_NEW_DRIVER_YET, Double.MAX_VALUE); if(bestI instanceof InsertionData.NoInsertionFound){ - throw new IllegalStateException(getErrorMsg(unassignedJob)); + throw new NoSolutionFoundException(getErrorMsg(unassignedJob)); } else{ bestInsertion = new Insertion(newRoute,bestI); diff --git a/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/NoSolutionFoundException.java b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/NoSolutionFoundException.java new file mode 100644 index 00000000..5acb2936 --- /dev/null +++ b/jsprit-core/src/main/java/jsprit/core/algorithm/recreate/NoSolutionFoundException.java @@ -0,0 +1,14 @@ +package jsprit.core.algorithm.recreate; + +public class NoSolutionFoundException extends IllegalStateException{ + + public NoSolutionFoundException(String errorMsg) { + super(errorMsg); + } + + /** + * + */ + private static final long serialVersionUID = 1L; + +}