You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2006/09/04 12:13:18 UTC
svn commit: r440008 -
/geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
Author: jdillon
Date: Mon Sep 4 03:13:17 2006
New Revision: 440008
URL: http://svn.apache.org/viewvc?view=rev&rev=440008
Log:
Use ObjectHolder instead of Throwable to hold errors in the runner thread
Modified:
geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
Modified: geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java?view=diff&rev=440008&r1=440007&r2=440008
==============================================================================
--- geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java (original)
+++ geronimo/server/trunk/maven-plugins/selenium-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/selenium/StartServerMojo.java Mon Sep 4 03:13:17 2006
@@ -34,6 +34,7 @@
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.geronimo.genesis.AntMojoSupport;
+import org.apache.geronimo.genesis.ObjectHolder;
import org.apache.commons.io.IOUtils;
@@ -234,8 +235,8 @@
java.createArg().setFile(userExtentionsFile);
}
- // Holds any exception that was thrown during startup (as the cause)
- final Throwable errorHolder = new Throwable();
+ // Holds any exception that was thrown during startup
+ final ObjectHolder errorHolder = new ObjectHolder();
// Start the server int a seperate thread
Thread t = new Thread("Selenium Server Runner") {
@@ -244,7 +245,7 @@
java.execute();
}
catch (Exception e) {
- errorHolder.initCause(e);
+ errorHolder.set(e);
//
// NOTE: Don't log here, as when the JVM exists an exception will get thrown by Ant
@@ -261,15 +262,14 @@
URL url = new URL("http://localhost:" + port + "/selenium-server");
boolean started = false;
while (!started) {
- if (errorHolder.getCause() != null) {
- throw new MojoExecutionException("Failed to start Selenium server", errorHolder.getCause());
+ if (errorHolder.isSet()) {
+ throw new MojoExecutionException("Failed to start Selenium server", (Throwable)errorHolder.get());
}
log.debug("Trying connection to: " + url);
try {
Object input = url.openConnection().getContent();
- log.debug("Input: " + input);
started = true;
}
catch (Exception e) {