Author: hlship
Date: Sun Mar  4 09:35:35 2007
New Revision: 514446

URL: http://svn.apache.org/viewvc?view=rev&rev=514446
Log:
Improve reporting of errors, to identify the HTML source.

Added:
    
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/ErrorReportingCommandProcessor.java
Modified:
    
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java

Modified: 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java?view=diff&rev=514446&r1=514445&r2=514446
==============================================================================
--- 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
 (original)
+++ 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/AbstractIntegrationTestSuite.java
 Sun Mar  4 09:35:35 2007
@@ -22,7 +22,9 @@
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Parameters;
 
+import com.thoughtworks.selenium.CommandProcessor;
 import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.HttpCommandProcessor;
 import com.thoughtworks.selenium.Selenium;
 
 /**
@@ -42,457 +44,455 @@
 public abstract class AbstractIntegrationTestSuite extends Assert implements 
Selenium
 {
 
-    /** 60 seconds */
-    public static final String PAGE_LOAD_TIMEOUT = "600000";
+  /** 60 seconds */
+  public static final String PAGE_LOAD_TIMEOUT = "600000";
 
-    /** The port on which the internal copy of Jetty is executed. */
-    public static final int JETTY_PORT = 9999;
+  /** The port on which the internal copy of Jetty is executed. */
+  public static final int JETTY_PORT = 9999;
 
-    // This is likely to be a problem, since may want to test with a context 
path, rather than as
-    // root.
-    public static final String BASE_URL = format("http://localhost:%d/";, 
JETTY_PORT);
-
-    private JettyRunner _jettyRunner;
-
-    private Selenium _selenium;
-
-    private SeleniumServer _server;
-
-    protected final void assertSourcePresent(String... expected)
-    {
-        String source = _selenium.getHtmlSource();
-
-        for (String snippet : expected)
-        {
-            if (source.contains(snippet))
-                continue;
-
-            System.err.printf("Source content '%s' not found in:\n%s\n\n", 
snippet, source);
-
-            throw new AssertionError("Page did not contain source '" + snippet 
+ "'.");
-        }
-    }
-
-    protected final void assertText(String locator, String expected)
-    {
-        String actual = null;
-
-        try
-        {
-            actual = getText(locator);
-        }
-        catch (RuntimeException ex)
-        {
-            System.err.printf(
-                    "Error accessing %s: %s, in:\n\n%s\n\n",
-                    locator,
-                    ex.getMessage(),
-                    _selenium.getHtmlSource());
-
-            throw ex;
-        }
-
-        if (actual.equals(expected))
-            return;
-
-        System.err.printf(
-                "Text for %s should be '%s' but is '%s', in:\n\n%s\n\n",
-                locator,
-                expected,
-                actual,
-                getHtmlSource());
-
-        throw new AssertionError(String.format("%s was '%s' not '%s'", 
locator, actual, expected));
-    }
-
-    protected final void assertTextPresent(String... text)
-    {
-        for (String item : text)
-        {
-            if (isTextPresent(item))
-                return;
-
-            System.err.printf("Text pattern '%s' not found in:\n%s\n\n", item, 
_selenium
-                    .getHtmlSource());
-
-            throw new AssertionError("Page did not contain '" + item + "'.");
-        }
-    }
-
-    protected final void assertFieldValue(String locator, String expected)
-    {
-        assertEquals(getValue(locator), expected);
-    }
-
-    protected final void clickAndWait(String link)
-    {
-        _selenium.click(link);
-        _selenium.waitForPageToLoad(PAGE_LOAD_TIMEOUT);
-    }
-
-    protected final void assertTextSeries(String idFormat, int startIndex, 
String... values)
-    {
-        for (int i = 0; i < values.length; i++)
-        {
-            String id = format(idFormat, startIndex + i);
-
-            assertText(id, values[i]);
-        }
-    }
-
-    @AfterClass
-    public void cleanup() throws Exception
-    {
-        _selenium.stop();
-        _selenium = null;
-
-        _server.stop();
-        _server = null;
-
-        _jettyRunner.stop();
-        _jettyRunner = null;
-    }
-
-    @Parameters(
-    { "tapestry.integration-webapp" })
-    @BeforeClass
-    public void setup(String webappRoot) throws Exception
-    {
-        _jettyRunner = new JettyRunner("/", JETTY_PORT, webappRoot);
-
-        _server = new SeleniumServer();
-
-        _server.start();
-
-        _selenium = new DefaultSelenium("localhost", 
SeleniumServer.DEFAULT_PORT, "*firefox",
-                BASE_URL);
-
-        _selenium.start();
-
-        // Warm things up; this prevents errors when the first test runs. 
Seems to be a problem
-        // with Selenium: inside the JavaScript or the server code.
-
-        _selenium.open(BASE_URL);
-    }
-
-    public void addSelection(String locator, String optionLocator)
-    {
-        _selenium.addSelection(locator, optionLocator);
-    }
-
-    public void answerOnNextPrompt(String answer)
-    {
-        _selenium.answerOnNextPrompt(answer);
-    }
-
-    public void check(String locator)
-    {
-        _selenium.check(locator);
-    }
-
-    public void chooseCancelOnNextConfirmation()
-    {
-        _selenium.chooseCancelOnNextConfirmation();
-    }
-
-    public void click(String locator)
-    {
-        _selenium.click(locator);
-    }
-
-    public void close()
-    {
-        _selenium.close();
-    }
-
-    public void fireEvent(String locator, String eventName)
-    {
-        _selenium.fireEvent(locator, eventName);
-    }
-
-    public String getAlert()
-    {
-        return _selenium.getAlert();
-    }
-
-    public String[] getAllButtons()
-    {
-        return _selenium.getAllButtons();
-    }
-
-    public String[] getAllFields()
-    {
-        return _selenium.getAllFields();
-    }
-
-    public String[] getAllLinks()
-    {
-        return _selenium.getAllLinks();
-    }
-
-    public String getAttribute(String attributeLocator)
-    {
-        return _selenium.getAttribute(attributeLocator);
-    }
-
-    public String getBodyText()
-    {
-        return _selenium.getBodyText();
-    }
-
-    public String getConfirmation()
-    {
-        return _selenium.getConfirmation();
-    }
-
-    public Number getCursorPosition(String locator)
-    {
-        return _selenium.getCursorPosition(locator);
-    }
-
-    public String getEval(String script)
-    {
-        return _selenium.getEval(script);
-    }
-
-    public String getExpression(String expression)
-    {
-        return _selenium.getExpression(expression);
-    }
-
-    public String getHtmlSource()
-    {
-        return _selenium.getHtmlSource();
-    }
-
-    public String getLocation()
-    {
-        return _selenium.getLocation();
-    }
-
-    public String getPrompt()
-    {
-        return _selenium.getPrompt();
-    }
-
-    public String getSelectedId(String selectLocator)
-    {
-        return _selenium.getSelectedId(selectLocator);
-    }
-
-    public String[] getSelectedIds(String selectLocator)
-    {
-        return _selenium.getSelectedIds(selectLocator);
-    }
-
-    public String getSelectedIndex(String selectLocator)
-    {
-        return _selenium.getSelectedIndex(selectLocator);
-    }
-
-    public String[] getSelectedIndexes(String selectLocator)
-    {
-        return _selenium.getSelectedIndexes(selectLocator);
-    }
-
-    public String getSelectedLabel(String selectLocator)
-    {
-        return _selenium.getSelectedLabel(selectLocator);
-    }
-
-    public String[] getSelectedLabels(String selectLocator)
-    {
-        return _selenium.getSelectedLabels(selectLocator);
-    }
-
-    public String getSelectedValue(String selectLocator)
-    {
-        return _selenium.getSelectedValue(selectLocator);
-    }
-
-    public String[] getSelectedValues(String selectLocator)
-    {
-        return _selenium.getSelectedValues(selectLocator);
-    }
-
-    public String[] getSelectOptions(String selectLocator)
-    {
-        return _selenium.getSelectOptions(selectLocator);
-    }
-
-    public String getTable(String tableCellAddress)
-    {
-        return _selenium.getTable(tableCellAddress);
-    }
-
-    public String getText(String locator)
-    {
-        return _selenium.getText(locator);
-    }
-
-    public String getTitle()
-    {
-        return _selenium.getTitle();
-    }
-
-    public String getValue(String locator)
-    {
-        return _selenium.getValue(locator);
-    }
-
-    public void goBack()
-    {
-        _selenium.goBack();
-    }
-
-    public boolean isAlertPresent()
-    {
-        return _selenium.isAlertPresent();
-    }
-
-    public boolean isChecked(String locator)
-    {
-        return _selenium.isChecked(locator);
-    }
-
-    public boolean isConfirmationPresent()
-    {
-        return _selenium.isConfirmationPresent();
-    }
-
-    public boolean isEditable(String locator)
-    {
-        return _selenium.isEditable(locator);
-    }
-
-    public boolean isElementPresent(String locator)
-    {
-        return _selenium.isElementPresent(locator);
-    }
-
-    public boolean isPromptPresent()
-    {
-        return _selenium.isPromptPresent();
-    }
-
-    public boolean isSomethingSelected(String selectLocator)
-    {
-        return _selenium.isSomethingSelected(selectLocator);
-    }
-
-    public boolean isTextPresent(String pattern)
-    {
-        return _selenium.isTextPresent(pattern);
-    }
-
-    public boolean isVisible(String locator)
-    {
-        return _selenium.isVisible(locator);
-    }
-
-    public void keyDown(String locator, String keycode)
-    {
-        _selenium.keyDown(locator, keycode);
-    }
-
-    public void keyPress(String locator, String keycode)
-    {
-        _selenium.keyPress(locator, keycode);
-    }
-
-    public void keyUp(String locator, String keycode)
-    {
-        _selenium.keyUp(locator, keycode);
-    }
-
-    public void mouseDown(String locator)
-    {
-        _selenium.mouseDown(locator);
-    }
-
-    public void mouseOver(String locator)
-    {
-        _selenium.mouseOver(locator);
-    }
-
-    public void open(String url)
-    {
-        _selenium.open(url);
-    }
-
-    public void refresh()
-    {
-        _selenium.refresh();
-    }
-
-    public void removeSelection(String locator, String optionLocator)
-    {
-        _selenium.removeSelection(locator, optionLocator);
-    }
-
-    public void select(String selectLocator, String optionLocator)
-    {
-        _selenium.select(selectLocator, optionLocator);
-    }
-
-    public void selectWindow(String windowID)
-    {
-        _selenium.selectWindow(windowID);
-    }
-
-    public void setContext(String context, String logLevelThreshold)
-    {
-        _selenium.setContext(context, logLevelThreshold);
-    }
-
-    public void setCursorPosition(String locator, String position)
-    {
-        _selenium.setCursorPosition(locator, position);
-    }
-
-    public void setTimeout(String timeout)
-    {
-        _selenium.setTimeout(timeout);
-    }
-
-    public void start()
-    {
-        _selenium.start();
-    }
-
-    public void stop()
-    {
-        _selenium.stop();
-    }
-
-    public void submit(String formLocator)
-    {
-        _selenium.submit(formLocator);
-    }
-
-    public void type(String locator, String value)
-    {
-        _selenium.type(locator, value);
-    }
-
-    public void uncheck(String locator)
-    {
-        _selenium.uncheck(locator);
-    }
-
-    public void waitForCondition(String script, String timeout)
-    {
-        _selenium.waitForCondition(script, timeout);
-    }
-
-    public void waitForPageToLoad(String timeout)
-    {
-        _selenium.waitForPageToLoad(timeout);
-    }
-
-    public void waitForPopUp(String windowID, String timeout)
-    {
-        _selenium.waitForPopUp(windowID, timeout);
-    }
+  // This is likely to be a problem, since may want to test with a context 
path, rather than as
+  // root.
+  public static final String BASE_URL = format("http://localhost:%d/";, 
JETTY_PORT);
+
+  private JettyRunner _jettyRunner;
+
+  private Selenium _selenium;
+
+  private SeleniumServer _server;
+
+  protected final void assertSourcePresent(String... expected)
+  {
+    String source = _selenium.getHtmlSource();
+
+    for (String snippet : expected)
+    {
+      if (source.contains(snippet)) continue;
+
+      System.err.printf("Source content '%s' not found in:\n%s\n\n", snippet, 
source);
+
+      throw new AssertionError("Page did not contain source '" + snippet + 
"'.");
+    }
+  }
+
+  protected final void assertText(String locator, String expected)
+  {
+    String actual = null;
+
+    try
+    {
+      actual = getText(locator);
+    }
+    catch (RuntimeException ex)
+    {
+      System.err.printf(
+          "Error accessing %s: %s, in:\n\n%s\n\n",
+          locator,
+          ex.getMessage(),
+          _selenium.getHtmlSource());
+
+      throw ex;
+    }
+
+    if (actual.equals(expected)) return;
+
+    System.err.printf(
+        "Text for %s should be '%s' but is '%s', in:\n\n%s\n\n",
+        locator,
+        expected,
+        actual,
+        getHtmlSource());
+
+    throw new AssertionError(String.format("%s was '%s' not '%s'", locator, 
actual, expected));
+  }
+
+  protected final void assertTextPresent(String... text)
+  {
+    for (String item : text)
+    {
+      if (isTextPresent(item)) return;
+
+      System.err.printf("Text pattern '%s' not found in:\n%s\n\n", item, 
_selenium.getHtmlSource());
+
+      throw new AssertionError("Page did not contain '" + item + "'.");
+    }
+  }
+
+  protected final void assertFieldValue(String locator, String expected)
+  {
+    assertEquals(getValue(locator), expected);
+  }
+
+  protected final void clickAndWait(String link)
+  {
+    click(link);
+    waitForPageToLoad(PAGE_LOAD_TIMEOUT);
+  }
+
+  protected final void assertTextSeries(String idFormat, int startIndex, 
String... values)
+  {
+    for (int i = 0; i < values.length; i++)
+    {
+      String id = format(idFormat, startIndex + i);
+
+      assertText(id, values[i]);
+    }
+  }
+
+  @AfterClass
+  public void cleanup() throws Exception
+  {
+    _selenium.stop();
+    _selenium = null;
+
+    _server.stop();
+    _server = null;
+
+    _jettyRunner.stop();
+    _jettyRunner = null;
+  }
+
+  @Parameters(
+  { "tapestry.integration-webapp" })
+  @BeforeClass
+  public void setup(String webappRoot) throws Exception
+  {
+    _jettyRunner = new JettyRunner("/", JETTY_PORT, webappRoot);
+
+    _server = new SeleniumServer();
+
+    _server.start();
+
+    CommandProcessor cp = new HttpCommandProcessor("localhost", 
SeleniumServer.DEFAULT_PORT,
+        "*firefox", BASE_URL);
+
+    _selenium = new DefaultSelenium(new ErrorReportingCommandProcessor(cp));
+
+    _selenium.start();
+
+    // Warm things up; this prevents errors when the first test runs. Seems to 
be a problem
+    // with Selenium: inside the JavaScript or the server code.
+
+    _selenium.open(BASE_URL);
+  }
+
+  public void addSelection(String locator, String optionLocator)
+  {
+    _selenium.addSelection(locator, optionLocator);
+  }
+
+  public void answerOnNextPrompt(String answer)
+  {
+    _selenium.answerOnNextPrompt(answer);
+  }
+
+  public void check(String locator)
+  {
+    _selenium.check(locator);
+  }
+
+  public void chooseCancelOnNextConfirmation()
+  {
+    _selenium.chooseCancelOnNextConfirmation();
+  }
+
+  public void click(String locator)
+  {
+    _selenium.click(locator);
+  }
+
+  public void close()
+  {
+    _selenium.close();
+  }
+
+  public void fireEvent(String locator, String eventName)
+  {
+    _selenium.fireEvent(locator, eventName);
+  }
+
+  public String getAlert()
+  {
+    return _selenium.getAlert();
+  }
+
+  public String[] getAllButtons()
+  {
+    return _selenium.getAllButtons();
+  }
+
+  public String[] getAllFields()
+  {
+    return _selenium.getAllFields();
+  }
+
+  public String[] getAllLinks()
+  {
+    return _selenium.getAllLinks();
+  }
+
+  public String getAttribute(String attributeLocator)
+  {
+    return _selenium.getAttribute(attributeLocator);
+  }
+
+  public String getBodyText()
+  {
+    return _selenium.getBodyText();
+  }
+
+  public String getConfirmation()
+  {
+    return _selenium.getConfirmation();
+  }
+
+  public Number getCursorPosition(String locator)
+  {
+    return _selenium.getCursorPosition(locator);
+  }
+
+  public String getEval(String script)
+  {
+    return _selenium.getEval(script);
+  }
+
+  public String getExpression(String expression)
+  {
+    return _selenium.getExpression(expression);
+  }
+
+  public String getHtmlSource()
+  {
+    return _selenium.getHtmlSource();
+  }
+
+  public String getLocation()
+  {
+    return _selenium.getLocation();
+  }
+
+  public String getPrompt()
+  {
+    return _selenium.getPrompt();
+  }
+
+  public String getSelectedId(String selectLocator)
+  {
+    return _selenium.getSelectedId(selectLocator);
+  }
+
+  public String[] getSelectedIds(String selectLocator)
+  {
+    return _selenium.getSelectedIds(selectLocator);
+  }
+
+  public String getSelectedIndex(String selectLocator)
+  {
+    return _selenium.getSelectedIndex(selectLocator);
+  }
+
+  public String[] getSelectedIndexes(String selectLocator)
+  {
+    return _selenium.getSelectedIndexes(selectLocator);
+  }
+
+  public String getSelectedLabel(String selectLocator)
+  {
+    return _selenium.getSelectedLabel(selectLocator);
+  }
+
+  public String[] getSelectedLabels(String selectLocator)
+  {
+    return _selenium.getSelectedLabels(selectLocator);
+  }
+
+  public String getSelectedValue(String selectLocator)
+  {
+    return _selenium.getSelectedValue(selectLocator);
+  }
+
+  public String[] getSelectedValues(String selectLocator)
+  {
+    return _selenium.getSelectedValues(selectLocator);
+  }
+
+  public String[] getSelectOptions(String selectLocator)
+  {
+    return _selenium.getSelectOptions(selectLocator);
+  }
+
+  public String getTable(String tableCellAddress)
+  {
+    return _selenium.getTable(tableCellAddress);
+  }
+
+  public String getText(String locator)
+  {
+    return _selenium.getText(locator);
+  }
+
+  public String getTitle()
+  {
+    return _selenium.getTitle();
+  }
+
+  public String getValue(String locator)
+  {
+    return _selenium.getValue(locator);
+  }
+
+  public void goBack()
+  {
+    _selenium.goBack();
+  }
+
+  public boolean isAlertPresent()
+  {
+    return _selenium.isAlertPresent();
+  }
+
+  public boolean isChecked(String locator)
+  {
+    return _selenium.isChecked(locator);
+  }
+
+  public boolean isConfirmationPresent()
+  {
+    return _selenium.isConfirmationPresent();
+  }
+
+  public boolean isEditable(String locator)
+  {
+    return _selenium.isEditable(locator);
+  }
+
+  public boolean isElementPresent(String locator)
+  {
+    return _selenium.isElementPresent(locator);
+  }
+
+  public boolean isPromptPresent()
+  {
+    return _selenium.isPromptPresent();
+  }
+
+  public boolean isSomethingSelected(String selectLocator)
+  {
+    return _selenium.isSomethingSelected(selectLocator);
+  }
+
+  public boolean isTextPresent(String pattern)
+  {
+    return _selenium.isTextPresent(pattern);
+  }
+
+  public boolean isVisible(String locator)
+  {
+    return _selenium.isVisible(locator);
+  }
+
+  public void keyDown(String locator, String keycode)
+  {
+    _selenium.keyDown(locator, keycode);
+  }
+
+  public void keyPress(String locator, String keycode)
+  {
+    _selenium.keyPress(locator, keycode);
+  }
+
+  public void keyUp(String locator, String keycode)
+  {
+    _selenium.keyUp(locator, keycode);
+  }
+
+  public void mouseDown(String locator)
+  {
+    _selenium.mouseDown(locator);
+  }
+
+  public void mouseOver(String locator)
+  {
+    _selenium.mouseOver(locator);
+  }
+
+  public void open(String url)
+  {
+    _selenium.open(url);
+  }
+
+  public void refresh()
+  {
+    _selenium.refresh();
+  }
+
+  public void removeSelection(String locator, String optionLocator)
+  {
+    _selenium.removeSelection(locator, optionLocator);
+  }
+
+  public void select(String selectLocator, String optionLocator)
+  {
+    _selenium.select(selectLocator, optionLocator);
+  }
+
+  public void selectWindow(String windowID)
+  {
+    _selenium.selectWindow(windowID);
+  }
+
+  public void setContext(String context, String logLevelThreshold)
+  {
+    _selenium.setContext(context, logLevelThreshold);
+  }
+
+  public void setCursorPosition(String locator, String position)
+  {
+    _selenium.setCursorPosition(locator, position);
+  }
+
+  public void setTimeout(String timeout)
+  {
+    _selenium.setTimeout(timeout);
+  }
+
+  public void start()
+  {
+    _selenium.start();
+  }
+
+  public void stop()
+  {
+    _selenium.stop();
+  }
+
+  public void submit(String formLocator)
+  {
+    _selenium.submit(formLocator);
+  }
+
+  public void type(String locator, String value)
+  {
+    _selenium.type(locator, value);
+  }
+
+  public void uncheck(String locator)
+  {
+    _selenium.uncheck(locator);
+  }
+
+  public void waitForCondition(String script, String timeout)
+  {
+    _selenium.waitForCondition(script, timeout);
+  }
+
+  public void waitForPageToLoad(String timeout)
+  {
+    _selenium.waitForPageToLoad(timeout);
+  }
+
+  public void waitForPopUp(String windowID, String timeout)
+  {
+    _selenium.waitForPopUp(windowID, timeout);
+  }
 
 }

Added: 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/ErrorReportingCommandProcessor.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/ErrorReportingCommandProcessor.java?view=auto&rev=514446
==============================================================================
--- 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/ErrorReportingCommandProcessor.java
 (added)
+++ 
tapestry/tapestry5/tapestry-test/trunk/src/main/java/org/apache/tapestry/test/ErrorReportingCommandProcessor.java
 Sun Mar  4 09:35:35 2007
@@ -0,0 +1,159 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.test;
+
+import com.thoughtworks.selenium.CommandProcessor;
+
+/**
+ * A wrapper around a standard command processor that adds additional 
exception reporting when a
+ * failure occurs.
+ */
+public class ErrorReportingCommandProcessor implements CommandProcessor
+{
+  private final CommandProcessor _delegate;
+
+  public ErrorReportingCommandProcessor(final CommandProcessor delegate)
+  {
+    _delegate = delegate;
+  }
+
+  private void reportError(String command, String[] args, RuntimeException ex)
+  {
+    StringBuilder builder = new StringBuilder();
+
+    builder.append("Seleninum expression processing comamnd ");
+    builder.append(command);
+    builder.append("(");
+
+    for (int i = 0; i < args.length; i++)
+    {
+      if (i > 0) builder.append(", ");
+      builder.append(args[i]);
+    }
+
+    builder.append("): ");
+    builder.append(ex.toString());
+
+    builder.append("\n\nPage source:\n");
+
+    builder.append(_delegate.getString("getHtmlSource", new String[] {}));
+
+    builder.append("\n\n");
+
+    System.err.println(builder.toString());
+  }
+
+  public String doCommand(String command, String[] args)
+  {
+    try
+    {
+      return _delegate.doCommand(command, args);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(command, args, ex);
+      throw ex;
+    }
+  }
+
+  public boolean getBoolean(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getBoolean(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public boolean[] getBooleanArray(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getBooleanArray(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public Number getNumber(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getNumber(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public Number[] getNumberArray(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getNumberArray(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public String getString(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getString(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public String[] getStringArray(String string, String[] strings)
+  {
+    try
+    {
+      return _delegate.getStringArray(string, strings);
+    }
+    catch (RuntimeException ex)
+    {
+      reportError(string, strings, ex);
+      throw ex;
+    }
+  }
+
+  public void start()
+  {
+    _delegate.start();
+  }
+
+  public void stop()
+  {
+    _delegate.stop();
+  }
+
+}


Reply via email to