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

Merge pull request #189 from HeinrichFilter/master

Removed all System.exit() calls (related to #182)
This commit is contained in:
Stefan Schröder 2015-09-28 10:37:23 +02:00
commit ca86a6651b
12 changed files with 24 additions and 76 deletions

View file

@ -77,9 +77,7 @@ public class AlgorithmConfigXmlReader {
try { try {
algorithmConfig.getXMLConfiguration().load(); algorithmConfig.getXMLConfiguration().load();
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
log.error(e); throw new RuntimeException(e);
e.printStackTrace();
System.exit(1);
} }
} }

View file

@ -519,7 +519,6 @@ public class VehicleRoutingAlgorithms {
@Override @Override
public void uncaughtException(Thread arg0, Throwable arg1) { public void uncaughtException(Thread arg0, Throwable arg1) {
System.err.println(arg1.toString()); System.err.println(arg1.toString());
System.exit(0);
} }
}); });
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {

View file

@ -130,9 +130,7 @@ public final class BestInsertionConcurrent extends AbstractInsertionStrategy {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (ExecutionException e) { } catch (ExecutionException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception", e);
System.exit(1);
} }
VehicleRoute newRoute = VehicleRoute.emptyRoute(); VehicleRoute newRoute = VehicleRoute.emptyRoute();
InsertionData newIData = bestInsertionCostCalculator.getInsertionData(newRoute, unassignedJob, NO_NEW_VEHICLE_YET, NO_NEW_DEPARTURE_TIME_YET, NO_NEW_DRIVER_YET, bestInsertionCost); InsertionData newIData = bestInsertionCostCalculator.getInsertionData(newRoute, unassignedJob, NO_NEW_VEHICLE_YET, NO_NEW_DEPARTURE_TIME_YET, NO_NEW_DRIVER_YET, bestInsertionCost);

View file

@ -163,9 +163,7 @@ public class VrpXMLReader {
try { try {
xmlConfig.load(); xmlConfig.load();
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logger.error("Exception:", e); throw new RuntimeException(e);
e.printStackTrace();
System.exit(1);
} }
readProblemType(xmlConfig); readProblemType(xmlConfig);
readVehiclesAndTheirTypes(xmlConfig); readVehiclesAndTheirTypes(xmlConfig);

View file

@ -117,9 +117,7 @@ public class VrpXMLWriter {
element.setAttribute("xsi:schemaLocation", "http://www.w3schools.com vrp_xml_schema.xsd"); element.setAttribute("xsi:schemaLocation", "http://www.w3schools.com vrp_xml_schema.xsd");
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
logger.error("Exception:", e); throw new RuntimeException(e);
e.printStackTrace();
System.exit(1);
} }
try { try {
@ -128,9 +126,7 @@ public class VrpXMLWriter {
serializer.serialize(xmlConfig.getDocument()); serializer.serialize(xmlConfig.getDocument());
out.close(); out.close();
} catch (IOException e) { } catch (IOException e) {
logger.error("Exception:", e); throw new RuntimeException(e);
e.printStackTrace();
System.exit(1);
} }

View file

@ -107,9 +107,7 @@ public class ChristofidesReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
} }
} }
@ -117,10 +115,7 @@ public class ChristofidesReader {
try { try {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
return null;
} }
} }
@ -135,9 +130,7 @@ public class ChristofidesReader {
try { try {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -136,9 +136,7 @@ public class CordeauReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
} }
} }
@ -146,10 +144,7 @@ public class CordeauReader {
try { try {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
return null;
} }
} }
@ -164,9 +159,7 @@ public class CordeauReader {
try { try {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -142,9 +142,7 @@ public class LiLimReader {
try { try {
reader = new BufferedReader(new FileReader(file)); reader = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -86,9 +86,7 @@ public class LopezIbanezBlumReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
} }
} }
@ -96,10 +94,7 @@ public class LopezIbanezBlumReader {
try { try {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
return null;
} }
} }
@ -108,9 +103,7 @@ public class LopezIbanezBlumReader {
try { try {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -149,9 +149,7 @@ public class LuiShenReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
} }
} }
@ -159,10 +157,7 @@ public class LuiShenReader {
try { try {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
return null;
} }
} }
@ -177,9 +172,7 @@ public class LuiShenReader {
try { try {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -127,9 +127,7 @@ public class SolomonReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
} }
} }
@ -137,10 +135,7 @@ public class SolomonReader {
try { try {
return reader.readLine(); return reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
logger.error("Exception:", e);
System.exit(1);
return null;
} }
} }
@ -155,9 +150,7 @@ public class SolomonReader {
try { try {
reader = new BufferedReader(new FileReader(solomonFile)); reader = new BufferedReader(new FileReader(solomonFile));
} catch (FileNotFoundException e1) { } catch (FileNotFoundException e1) {
e1.printStackTrace(); throw new RuntimeException(e1);
logger.error("Exception:", e1);
System.exit(1);
} }
return reader; return reader;
} }

View file

@ -138,8 +138,7 @@ public class VrphGoldenReader {
try { try {
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
System.exit(1);
} }
} }
@ -148,8 +147,7 @@ public class VrphGoldenReader {
try { try {
readLine = reader.readLine(); readLine = reader.readLine();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
System.exit(1);
} }
return readLine; return readLine;
} }
@ -160,10 +158,8 @@ public class VrphGoldenReader {
bufferedReader = new BufferedReader(new FileReader(new File(filename))); bufferedReader = new BufferedReader(new FileReader(new File(filename)));
return bufferedReader; return bufferedReader;
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
e.printStackTrace(); throw new RuntimeException(e);
System.exit(1);
} }
return bufferedReader;
} }
public static void main(String[] args) { public static void main(String[] args) {