Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Hein2014-11-19 10:09:32 +0000
committerMarcel Hein2014-11-19 10:09:38 +0000
commit33fd7bdf4792edc55e8fe475d5a6036fdfeba798 (patch)
treeac03a645358729c29392319171236385eb708792
parent1adc92ebc4f42f15684c314d05045e8effe25727 (diff)
downloadorg.eclipse.jubula.core-33fd7bdf4792edc55e8fe475d5a6036fdfeba798.tar.gz
org.eclipse.jubula.core-33fd7bdf4792edc55e8fe475d5a6036fdfeba798.tar.xz
org.eclipse.jubula.core-33fd7bdf4792edc55e8fe475d5a6036fdfeba798.zip
Non Sprint Task: Added different exit codes and error logging for exception which can occur when an AUT is started
-rw-r--r--org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/AutServerLauncher.java47
-rw-r--r--org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/AUTServerExitConstants.java15
2 files changed, 42 insertions, 20 deletions
diff --git a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/AutServerLauncher.java b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/AutServerLauncher.java
index 6159a1fb6..162f9af95 100644
--- a/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/AutServerLauncher.java
+++ b/org.eclipse.jubula.rc.common/src/org/eclipse/jubula/rc/common/AutServerLauncher.java
@@ -16,8 +16,10 @@ import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Arrays;
import java.util.StringTokenizer;
+import org.eclipse.jubula.rc.common.logger.AutServerLogger;
import org.eclipse.jubula.tools.internal.constants.AUTServerExitConstants;
@@ -32,6 +34,10 @@ public class AutServerLauncher {
*/
private static final String ENV_VAR_USE_CLASSIC_CLASSLOADER =
"TEST_USE_CLASSIC_CL"; //$NON-NLS-1$
+
+ /** the logger */
+ private static AutServerLogger log = new AutServerLogger(
+ AutServerLauncher.class);
/**
* hidden constructor
@@ -66,14 +72,12 @@ public class AutServerLauncher {
} catch (Throwable t) {
// OK, looks like we won't be able to access environment variables.
// We'll just assume that the variable wasn't set.
- }
-
+ }
if (useClassicClassLoaderValue == null) {
// Use JVM property as fallback
useClassicClassLoaderValue =
System.getProperty(ENV_VAR_USE_CLASSIC_CLASSLOADER);
- }
-
+ }
if (useClassicClassLoaderValue != null) {
// Use the old class loading
autServerClassLoader = new UrlClassicClassLoader(urls,
@@ -82,10 +86,8 @@ public class AutServerLauncher {
// Use the new class loading
autServerClassLoader = new UrlDefaultClassLoader(urls,
ClassLoader.getSystemClassLoader());
- }
-
+ }
Thread.currentThread().setContextClassLoader(autServerClassLoader);
-
try {
// the AUTServer is loaded with a separate ClassLoader because
// the AUT MUST NOT know the classpath of the AUTServer!!!
@@ -93,27 +95,32 @@ public class AutServerLauncher {
.loadClass(Constants.AUTSERVER_CLASSNAME);
Method mainMethod = autServerClass.getMethod("main", //$NON-NLS-1$
new Class[] {args.getClass()});
- mainMethod.invoke(null, new Object[] {args});
-
+ mainMethod.invoke(null, new Object[] {args});
} catch (ClassNotFoundException e) {
- /** FIXME Andreas Handling */
- System.exit(AUTServerExitConstants.AUT_START_ERROR);
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
+ System.exit(AUTServerExitConstants.AUT_START_ERROR_CNFE);
} catch (IllegalAccessException e) {
- /** FIXME Andreas Handling */
- System.exit(AUTServerExitConstants.AUT_START_ERROR);
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
+ System.exit(AUTServerExitConstants.AUT_START_ERROR_IACCE);
} catch (SecurityException e) {
- /** FIXME Andreas Handling */
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
System.exit(AUTServerExitConstants
.EXIT_SECURITY_VIOLATION_REFLECTION);
} catch (NoSuchMethodException e) {
- /** FIXME Andreas Handling */
- System.exit(AUTServerExitConstants.AUT_START_ERROR);
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
+ System.exit(AUTServerExitConstants.AUT_START_ERROR_NSME);
} catch (IllegalArgumentException e) {
- /** FIXME Andreas Handling */
- System.exit(AUTServerExitConstants.AUT_START_ERROR);
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
+ System.exit(AUTServerExitConstants.AUT_START_ERROR_IARGE);
} catch (InvocationTargetException e) {
- /** FIXME Andreas Handling */
- System.exit(AUTServerExitConstants.AUT_START_ERROR);
+ e.printStackTrace();
+ log.error(e.toString() + " " + Arrays.toString(e.getStackTrace()));
+ System.exit(AUTServerExitConstants.AUT_START_ERROR_INVTE);
}
}
diff --git a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/AUTServerExitConstants.java b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/AUTServerExitConstants.java
index c64c90aa9..2c2ddae68 100644
--- a/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/AUTServerExitConstants.java
+++ b/org.eclipse.jubula.tools/src/org/eclipse/jubula/tools/internal/constants/AUTServerExitConstants.java
@@ -66,6 +66,21 @@ public class AUTServerExitConstants {
/** exit state in case of an error while starting the AUT */
public static final int AUT_START_ERROR = 25;
+ /** exit state in case of an ClassNotFoundException while starting the AUT */
+ public static final int AUT_START_ERROR_CNFE = 27;
+
+ /** exit state in case of an IllegalAccessException while starting the AUT */
+ public static final int AUT_START_ERROR_IACCE = 28;
+
+ /** exit state in case of an NoSuchMethodException while starting the AUT */
+ public static final int AUT_START_ERROR_NSME = 29;
+
+ /** exit state in case of an IllegalArgumentException while starting the AUT */
+ public static final int AUT_START_ERROR_IARGE = 30;
+
+ /**exit state in case of an InvocationTargetException while starting the AUT */
+ public static final int AUT_START_ERROR_INVTE = 31;
+
/** exit state in case that the started AUT is not supported
* through the UI automation framework */
public static final int AUT_NOT_UIA_SUPPORTED = 26;

Back to the top