mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
Removed all System.exit() calls (related to #182)
Most calls were replaced by Runtime exceptions. This gives the client some opportuinity to respond to the exceptions.
This commit is contained in:
parent
e25b61cac4
commit
21c7d2bf83
12 changed files with 24 additions and 76 deletions
|
|
@ -107,9 +107,7 @@ public class ChristofidesReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -117,10 +115,7 @@ public class ChristofidesReader {
|
|||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,9 +130,7 @@ public class ChristofidesReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,9 +136,7 @@ public class CordeauReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -146,10 +144,7 @@ public class CordeauReader {
|
|||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,9 +159,7 @@ public class CordeauReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,9 +142,7 @@ public class LiLimReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(file));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ public class LopezIbanezBlumReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,10 +94,7 @@ public class LopezIbanezBlumReader {
|
|||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,9 +103,7 @@ public class LopezIbanezBlumReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,9 +149,7 @@ public class LuiShenReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,10 +157,7 @@ public class LuiShenReader {
|
|||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,9 +172,7 @@ public class LuiShenReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,9 +127,7 @@ public class SolomonReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,10 +135,7 @@ public class SolomonReader {
|
|||
try {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.error("Exception:", e);
|
||||
System.exit(1);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -155,9 +150,7 @@ public class SolomonReader {
|
|||
try {
|
||||
reader = new BufferedReader(new FileReader(solomonFile));
|
||||
} catch (FileNotFoundException e1) {
|
||||
e1.printStackTrace();
|
||||
logger.error("Exception:", e1);
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,8 +138,7 @@ public class VrphGoldenReader {
|
|||
try {
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,8 +147,7 @@ public class VrphGoldenReader {
|
|||
try {
|
||||
readLine = reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return readLine;
|
||||
}
|
||||
|
|
@ -160,10 +158,8 @@ public class VrphGoldenReader {
|
|||
bufferedReader = new BufferedReader(new FileReader(new File(filename)));
|
||||
return bufferedReader;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bufferedReader;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue