Author: mrdon
Date: Mon Jul 10 20:34:11 2006
New Revision: 420690
URL: http://svn.apache.org/viewvc?rev=420690&view=rev
Log:
Changed RuntimeExceptions to new StrutsException. Still too many places that
catch Exception and just log the error, but this is a start.
WW-335
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsException.java
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DefaultRichtexteditorConnector.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/I18n.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Param.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesConfiguration.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXMLConfigurationProvider.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DOMAdapter.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultAdapterNode.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultElementAdapter.java
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
Added:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsException.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsException.java?rev=420690&view=auto
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsException.java
(added)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsException.java
Mon Jul 10 20:34:11 2006
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2002-2006 by OpenSymphony
+ * All rights reserved.
+ */
+package org.apache.struts2;
+
+import com.opensymphony.xwork2.XWorkException;
+import com.opensymphony.xwork2.util.location.Locatable;
+import com.opensymphony.xwork2.util.location.Location;
+
+
+/**
+ * A generic runtime exception that optionally contains Location information
+ */
+public class StrutsException extends XWorkException implements Locatable {
+
+ private Location location;
+
+
+ /**
+ * Constructs a <code>StrutsException</code> with no detail message.
+ */
+ public StrutsException() {
+ }
+
+ /**
+ * Constructs a <code>StrutsException</code> with the specified
+ * detail message.
+ *
+ * @param s the detail message.
+ */
+ public StrutsException(String s) {
+ this(s, null, null);
+ }
+
+ /**
+ * Constructs a <code>StrutsException</code> with the specified
+ * detail message and target.
+ *
+ * @param s the detail message.
+ * @param target the target of the exception.
+ */
+ public StrutsException(String s, Object target) {
+ this(s, (Throwable) null, target);
+ }
+
+ /**
+ * Constructs a <code>StrutsException</code> with the root cause
+ *
+ * @param cause The wrapped exception
+ */
+ public StrutsException(Throwable cause) {
+ this(null, cause, null);
+ }
+
+ /**
+ * Constructs a <code>StrutsException</code> with the root cause and target
+ *
+ * @param cause The wrapped exception
+ * @param target The target of the exception
+ */
+ public StrutsException(Throwable cause, Object target) {
+ this(null, cause, target);
+ }
+
+ /**
+ * Constructs a <code>StrutsException</code> with the specified
+ * detail message and exception cause.
+ *
+ * @param s the detail message.
+ * @param cause the wrapped exception
+ */
+ public StrutsException(String s, Throwable cause) {
+ this(s, cause, null);
+ }
+
+
+ /**
+ * Constructs a <code>StrutsException</code> with the specified
+ * detail message, cause, and target
+ *
+ * @param s the detail message.
+ * @param cause The wrapped exception
+ * @param target The target of the exception
+ */
+ public StrutsException(String s, Throwable cause, Object target) {
+ super(s, cause, target);
+ }
+}
\ No newline at end of file
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/ActionComponent.java
Mon Jul 10 20:34:11 2006
@@ -18,6 +18,7 @@
package org.apache.struts2.components;
import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.dispatcher.DispatcherUtils;
import org.apache.struts2.dispatcher.RequestMap;
import org.apache.struts2.views.jsp.TagUtils;
@@ -186,9 +187,7 @@
String actualName = findString(name, "name", "Action name is required.
Example: updatePerson");
if (actualName == null) {
- String message = "Unable to find value for name " + name;
- LOG.error(message);
- throw new RuntimeException(message);
+ throw new StrutsException("Unable to find value for name " + name);
}
// handle "name!method" convention.
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Component.java
Mon Jul 10 20:34:11 2006
@@ -17,6 +17,7 @@
*/
package org.apache.struts2.components;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.util.FastByteArrayOutputStream;
import org.apache.struts2.views.jsp.TagUtils;
import org.apache.struts2.views.util.ContextUtil;
@@ -138,7 +139,7 @@
try {
writer.write(body);
} catch (IOException e) {
- throw new RuntimeException("IOError while writing the body: " +
e.getMessage(), e);
+ throw new StrutsException("IOError while writing the body: " +
e.getMessage(), e);
}
if (popComponentStack) {
popComponentStack();
@@ -195,7 +196,7 @@
* @param field field name used when throwing
<code>RuntimeException</code>.
* @param errorMsg error message used when throwing
<code>RuntimeException</code>.
* @return the String value found.
- * @throws RuntimeException is thrown in case of expression is
<tt>null</tt>.
+ * @throws StrutsException is thrown in case of expression is
<tt>null</tt>.
*/
protected String findString(String expr, String field, String errorMsg) {
if (expr == null) {
@@ -213,17 +214,11 @@
* @param field field name used when throwing
<code>RuntimeException</code>.
* @param errorMsg error message used when throwing
<code>RuntimeException</code>.
* @param e the caused exception, can be <tt>null</tt>.
- * @return the constructed <code>RuntimeException</code>.
+ * @return the constructed <code>StrutsException</code>.
*/
- protected RuntimeException fieldError(String field, String errorMsg,
Exception e) {
+ protected StrutsException fieldError(String field, String errorMsg,
Exception e) {
String msg = "tag " + getComponentName() + ", field " + field + ": " +
errorMsg;
- if (e == null) {
- LOG.error(msg);
- return new RuntimeException(msg);
- } else {
- LOG.error(msg, e);
- return new RuntimeException(msg, e);
- }
+ throw new StrutsException(msg, e);
}
/**
@@ -272,7 +267,7 @@
* @param field field name used when throwing
<code>RuntimeException</code>.
* @param errorMsg error message used when throwing
<code>RuntimeException</code>.
* @return the Object found, is never <tt>null</tt>.
- * @throws RuntimeException is thrown in case of not found in the OGNL
stack, or expression is <tt>null</tt>.
+ * @throws StrutsException is thrown in case of not found in the OGNL
stack, or expression is <tt>null</tt>.
*/
protected Object findValue(String expr, String field, String errorMsg) {
if (expr == null) {
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DefaultRichtexteditorConnector.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DefaultRichtexteditorConnector.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DefaultRichtexteditorConnector.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/DefaultRichtexteditorConnector.java
Mon Jul 10 20:34:11 2006
@@ -33,6 +33,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.util.ServletContextAware;
import org.apache.struts2.views.util.UrlHelper;
@@ -168,7 +169,7 @@
}
protected void unknownCommand(String command, String virtualFolderPath,
String type, String filename, String contentType, java.io.File newFile) {
- throw new RuntimeException("unknown command "+command);
+ throw new StrutsException("Unknown command "+command);
}
@@ -186,7 +187,7 @@
_log.debug("make directory "+dir);
boolean ok = dir.mkdirs();
if (! ok) {
- throw new RuntimeException("cannot make
directory "+dir);
+ throw new StrutsException("Cannot make
directory "+dir);
}
return false;
}
@@ -204,7 +205,7 @@
_log.debug("creating file "+filePath);
boolean ok = f.createNewFile();
if (! ok) {
- throw new RuntimeException("cannot create file
"+filePath);
+ throw new StrutsException("Cannot create file
"+filePath);
}
return false;
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/I18n.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/I18n.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/I18n.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/I18n.java
Mon Jul 10 20:34:11 2006
@@ -24,6 +24,7 @@
import com.opensymphony.xwork2.util.OgnlValueStack;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import java.io.Writer;
import java.util.Locale;
@@ -108,8 +109,7 @@
}
} catch (Exception e) {
String msg = "Could not find the bundle " + name;
- LOG.error(msg, e);
- throw new RuntimeException(msg);
+ throw new StrutsException(msg, e);
}
return result;
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Param.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Param.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Param.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/Param.java
Mon Jul 10 20:34:11 2006
@@ -21,6 +21,8 @@
import java.io.Writer;
+import org.apache.struts2.StrutsException;
+
/**
* <!-- START SNIPPET: javadoc -->
* <p>This tag can be used to parameterize other tags.</p>
@@ -101,7 +103,7 @@
String name = findString(this.name);
if (name == null) {
- throw new RuntimeException("No name found for following
expression: " + name);
+ throw new StrutsException("No name found for following
expression: " + name);
}
Object value = findValue(this.value);
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/URL.java
Mon Jul 10 20:34:11 2006
@@ -17,6 +17,7 @@
*/
package org.apache.struts2.components;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.portlet.context.PortletActionContext;
import org.apache.struts2.portlet.util.PortletUrlHelper;
import org.apache.struts2.views.util.UrlHelper;
@@ -238,8 +239,7 @@
try {
writer.write(result);
} catch (IOException e) {
- e.printStackTrace();
- throw new RuntimeException("IOError: " + e.getMessage(), e);
+ throw new StrutsException("IOError: " + e.getMessage(), e);
}
}
return super.end(writer, body);
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/table/WebTable.java
Mon Jul 10 20:34:11 2006
@@ -17,6 +17,7 @@
*/
package org.apache.struts2.components.table;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.components.GenericUIBean;
import org.apache.struts2.components.table.renderer.CellRenderer;
import com.opensymphony.xwork2.util.OgnlValueStack;
@@ -97,8 +98,7 @@
LOG.debug("we just sorted the data");
}
} catch (Exception e) {
- LOG.error(e);
- throw new RuntimeException("Error with WebTable: " +
toString(e));
+ throw new StrutsException("Error with WebTable: " +
toString(e), e);
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesConfiguration.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesConfiguration.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesConfiguration.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesConfiguration.java
Mon Jul 10 20:34:11 2006
@@ -22,6 +22,8 @@
import java.util.Iterator;
import java.util.Properties;
+import org.apache.struts2.StrutsException;
+
/**
* A class to handle configuration via a properties file.
@@ -51,7 +53,7 @@
try {
settings.load(settingsUrl.openStream());
} catch (IOException e) {
- throw new RuntimeException("Could not load " + name +
".properties:" + e);
+ throw new StrutsException("Could not load " + name +
".properties:" + e, e);
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXMLConfigurationProvider.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXMLConfigurationProvider.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXMLConfigurationProvider.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/StrutsXMLConfigurationProvider.java
Mon Jul 10 20:34:11 2006
@@ -7,6 +7,7 @@
import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import java.io.File;
import java.io.FileInputStream;
@@ -72,7 +73,7 @@
try {
is = new FileInputStream(file);
} catch (FileNotFoundException ex) {
- throw new RuntimeException("File not found: "+file, ex);
+ throw new StrutsException("File not found: "+file, ex);
}
} else {
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/ActionMapperFactory.java
Mon Jul 10 20:34:11 2006
@@ -19,6 +19,8 @@
import org.apache.struts2.config.Configuration;
import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.StrutsException;
+
import com.opensymphony.xwork2.ObjectFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,8 +54,7 @@
return mapper;
} catch (Exception e) {
String msg = "Could not create ActionMapper: Struts will *not*
work!";
- LOG.fatal(msg, e);
- throw new RuntimeException(msg, e);
+ throw new StrutsException(msg, e);
}
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/ScopeInterceptor.java
Mon Jul 10 20:34:11 2006
@@ -25,6 +25,7 @@
import com.opensymphony.xwork2.util.OgnlValueStack;
import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -213,7 +214,7 @@
locks.remove(o);
o.notify();
- throw new RuntimeException("Deadlock in session lock");
+ throw new StrutsException("Deadlock in session lock");
}
o.wait(10000);
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/sitegraph/SiteGraph.java
Mon Jul 10 20:34:11 2006
@@ -3,6 +3,7 @@
*/
package org.apache.struts2.sitegraph;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.sitegraph.renderers.DOTRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -92,7 +93,7 @@
try {
writer = new FileWriter(output + "/out.dot");
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new StrutsException(e);
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/velocity/VelocityManager.java
Mon Jul 10 20:34:11 2006
@@ -19,6 +19,7 @@
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.StrutsConstants;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.config.Configuration;
import org.apache.struts2.util.VelocityStrutsUtil;
import org.apache.struts2.views.jsp.ui.OgnlTool;
@@ -450,8 +451,7 @@
velocityEngine.init(p);
} catch (Exception e) {
String gripe = "Unable to instantiate VelocityEngine!";
- log.error(gripe, e);
- throw new RuntimeException(gripe);
+ throw new StrutsException(gripe, e);
}
return velocityEngine;
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java
Mon Jul 10 20:34:11 2006
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import java.beans.IntrospectionException;
import java.beans.Introspector;
@@ -131,8 +132,8 @@
return props;
} catch (IntrospectionException e) {
- e.printStackTrace();
- throw new RuntimeException("Error getting property descriptors for
" + bean + " : " + e.getMessage());
+ throw new StrutsException("Error getting property descriptors for
"
+ + bean + " : " + e.getMessage(), e);
}
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DOMAdapter.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DOMAdapter.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DOMAdapter.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DOMAdapter.java
Mon Jul 10 20:34:11 2006
@@ -19,6 +19,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import org.w3c.dom.Node;
import java.lang.reflect.Constructor;
@@ -148,7 +149,7 @@
return adapter;
} catch (Exception e) {
LOG.debug("Cannot adapt ", e);
- throw new RuntimeException("Cannot adapt " + parent + " (" +
propertyName + ") ", e);
+ throw new StrutsException("Cannot adapt " + parent + " (" +
propertyName + ") ", e);
}
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultAdapterNode.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultAdapterNode.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultAdapterNode.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultAdapterNode.java
Mon Jul 10 20:34:11 2006
@@ -18,6 +18,7 @@
package org.apache.struts2.views.xslt;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsException;
import org.w3c.dom.*;
@@ -237,7 +238,7 @@
}
protected void operationNotSupported() {
- throw new RuntimeException("Operation not supported.");
+ throw new StrutsException("Operation not supported.");
}
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultElementAdapter.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultElementAdapter.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultElementAdapter.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/DefaultElementAdapter.java
Mon Jul 10 20:34:11 2006
@@ -17,6 +17,7 @@
*/
package org.apache.struts2.views.xslt;
+import org.apache.struts2.StrutsException;
import org.w3c.dom.*;
import java.util.ArrayList;
@@ -128,7 +129,7 @@
int index = getAdapters().indexOf(child);
if (index < 0) {
- throw new RuntimeException(child + " is no child of " + this);
+ throw new StrutsException(child + " is no child of " + this);
}
int siblingIndex = index + 1;
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java
(original)
+++
struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/xslt/SimpleTextNode.java
Mon Jul 10 20:34:11 2006
@@ -17,6 +17,7 @@
*/
package org.apache.struts2.views.xslt;
+import org.apache.struts2.StrutsException;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
@@ -33,7 +34,7 @@
public void setData(String string) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public String getData() throws DOMException {
@@ -57,23 +58,23 @@
}
public void appendData(String string) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public void deleteData(int i, int i1) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public void insertData(int i, String string) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public void replaceData(int i, int i1, String string) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public Text splitText(int i) throws DOMException {
- throw new RuntimeException("Operation not supported");
+ throw new StrutsException("Operation not supported");
}
public String substringData(int beginIndex, int endIndex) throws
DOMException {
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
Mon Jul 10 20:34:11 2006
@@ -20,6 +20,7 @@
import com.opensymphony.xwork2.*;
import com.opensymphony.xwork2.util.OgnlValueStack;
import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.TestAction;
import org.apache.struts2.TestActionTagResult;
import org.apache.struts2.TestConfigurationProvider;
@@ -190,7 +191,7 @@
tag.doStartTag();
tag.doEndTag();
fail("Should have thrown RuntimeException");
- } catch (RuntimeException e) {
+ } catch (StrutsException e) {
assertEquals("tag actioncomponent, field name: Action name is
required. Example: updatePerson", e.getMessage());
}
}
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/IncludeTagTest.java
Mon Jul 10 20:34:11 2006
@@ -18,6 +18,8 @@
package org.apache.struts2.views.jsp;
import com.mockobjects.servlet.MockRequestDispatcher;
+
+import org.apache.struts2.StrutsException;
import org.apache.struts2.components.Include;
import org.easymock.MockControl;
@@ -39,7 +41,7 @@
tag.doStartTag();
tag.doEndTag();
fail("Should have thrown exception as no URL is specified in
setValue");
- } catch (RuntimeException e) {
+ } catch (StrutsException e) {
assertEquals("tag include, field value: You must specify the URL
to include. Example: /foo.jsp", e.getMessage());
}
}
Modified:
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java?rev=420690&r1=420689&r2=420690&view=diff
==============================================================================
---
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
(original)
+++
struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
Mon Jul 10 20:34:11 2006
@@ -18,6 +18,7 @@
package org.apache.struts2.views.jsp;
import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.StrutsException;
import org.apache.struts2.TestAction;
import org.apache.struts2.components.Text;
import org.apache.struts2.views.jsp.ui.TestAction1;
@@ -238,7 +239,7 @@
tag.doStartTag();
tag.doEndTag();
fail("Should have thrown a RuntimeException");
- } catch (RuntimeException e) {
+ } catch (StrutsException e) {
assertEquals(msg, e.getMessage());
}
}