summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/c2kernel/process/AbstractMain.java17
-rw-r--r--src/main/java/com/c2kernel/process/resource/BadArgumentsException.java17
2 files changed, 26 insertions, 8 deletions
diff --git a/src/main/java/com/c2kernel/process/AbstractMain.java b/src/main/java/com/c2kernel/process/AbstractMain.java
index b594c1a..e241ee2 100644
--- a/src/main/java/com/c2kernel/process/AbstractMain.java
+++ b/src/main/java/com/c2kernel/process/AbstractMain.java
@@ -17,6 +17,7 @@ import java.io.PrintStream;
import java.util.Enumeration;
import java.util.Properties;
+import com.c2kernel.process.resource.BadArgumentsException;
import com.c2kernel.utils.FileStringUtility;
import com.c2kernel.utils.Logger;
@@ -33,7 +34,7 @@ abstract public class AbstractMain
/**************************************************************************
* reading and setting input paramaters
**************************************************************************/
- public static Properties readC2KArgs( String[] args ) throws Exception {
+ public static Properties readC2KArgs( String[] args ) throws BadArgumentsException {
Properties c2kProps;
Properties argProps = new Properties();
int logLevel = 0;
@@ -44,7 +45,7 @@ abstract public class AbstractMain
if (args[i].startsWith("-") && args[i].length()>1) {
String key = args[i].substring(1);
if (argProps.containsKey(key))
- throw new Exception("Argument "+args[i]+" given twice");
+ throw new BadArgumentsException("Argument "+args[i]+" given twice");
String value = "";
if (!args[i+1].startsWith("-"))
value = args[++i];
@@ -52,7 +53,7 @@ abstract public class AbstractMain
i++;
}
else
- throw new Exception("Bad argument: "+args[i]);
+ throw new BadArgumentsException("Bad argument: "+args[i]);
}
@@ -61,7 +62,7 @@ abstract public class AbstractMain
logStream = new PrintStream(new FileOutputStream(argProps.getProperty("logFile"), true));
} catch (FileNotFoundException e) {
e.printStackTrace();
- throw new Exception("Logfile "+argProps.getProperty("logFile")+" cannot be created");
+ throw new BadArgumentsException("Logfile "+argProps.getProperty("logFile")+" cannot be created");
}
// Set up log stream
@@ -78,10 +79,10 @@ abstract public class AbstractMain
String configPath = argProps.getProperty("config");
if (configPath == null)
- throw new Exception("Config file not specified");
+ throw new BadArgumentsException("Config file not specified");
if (!new File(configPath).exists())
- throw new Exception("Config file "+configPath+" not found");
+ throw new BadArgumentsException("Config file "+configPath+" not found");
else
Logger.msg(0, "Config file: "+configPath);
@@ -91,10 +92,10 @@ abstract public class AbstractMain
String connectFile = c2kProps.getProperty("connect");
if (connectFile == null)
- throw new Exception("Connect file not specified");
+ throw new BadArgumentsException("Connect file not specified");
if (!new File(connectFile).exists())
- throw new Exception("Connect file "+connectFile+" not found");
+ throw new BadArgumentsException("Connect file "+connectFile+" not found");
else
Logger.msg(0, "Connect file: "+connectFile);
diff --git a/src/main/java/com/c2kernel/process/resource/BadArgumentsException.java b/src/main/java/com/c2kernel/process/resource/BadArgumentsException.java
new file mode 100644
index 0000000..c7fe7cf
--- /dev/null
+++ b/src/main/java/com/c2kernel/process/resource/BadArgumentsException.java
@@ -0,0 +1,17 @@
+package com.c2kernel.process.resource;
+
+public class BadArgumentsException extends Exception {
+
+ public BadArgumentsException() {
+ super();
+ }
+
+ public BadArgumentsException(String message) {
+ super(message);
+ }
+
+ public BadArgumentsException(Throwable cause) {
+ super(cause);
+ }
+
+}