You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by pb...@apache.org on 2007/07/21 07:41:50 UTC
svn commit: r558248 - in
/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles:
DefinitionsFactoryException.java FactoryNotFoundException.java
TilesException.java TilesPlugin.java taglib/InsertTag.java
xmlDefinition/I18nFactorySet.java
Author: pbenedict
Date: Fri Jul 20 22:41:49 2007
New Revision: 558248
URL: http://svn.apache.org/viewvc?view=rev&rev=558248
Log:
STR-2437: Add root cause to TilesException
Modified:
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/DefinitionsFactoryException.java
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/FactoryNotFoundException.java
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesException.java
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesPlugin.java
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java
struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/DefinitionsFactoryException.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/DefinitionsFactoryException.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/DefinitionsFactoryException.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/DefinitionsFactoryException.java Fri Jul 20 22:41:49 2007
@@ -34,7 +34,6 @@
public DefinitionsFactoryException()
{
super();
- this.exception = null;
}
/**
@@ -44,80 +43,28 @@
public DefinitionsFactoryException(String message)
{
super(message);
- this.exception = null;
}
/**
* Create a new <code>DefinitionsFactoryException</code> wrapping an existing exception.
*
- * <p>The existing exception will be embedded in the new
- * one and its message will become the default message for
- * the DefinitionsFactoryException.</p>
- *
* @param e The exception to be wrapped.
*/
public DefinitionsFactoryException(Exception e)
{
super();
- this.exception = e;
}
/**
* Create a new <code>DefinitionsFactoryException</code> from an existing exception.
*
- * <p>The existing exception will be embedded in the new
- * one, but the new exception will have its own message.</p>
- *
* @param message The detail message.
- * @param e The exception to be wrapped.
+ * @param e The root cause exception
*/
public DefinitionsFactoryException(String message, Exception e)
{
- super(message);
- this.exception = e;
+ super(message, e);
}
-
-
- /**
- * Return a detail message for this exception.
- *
- * <p>If there is a embedded exception, and if the DefinitionsFactoryException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.</p>
- *
- * @return The error or warning message.
- */
- public String getMessage ()
- {
- String message = super.getMessage ();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
- }
-
-
- /**
- * Return the embedded exception, if any.
- * @return The embedded exception, or <code>null</code> if there is none.
- */
- public Exception getException ()
- {
- return exception;
- }
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Any "wrapped" exception will be exposed when this is serialized.
- * @serial
- */
- private Exception exception;
}
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/FactoryNotFoundException.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/FactoryNotFoundException.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/FactoryNotFoundException.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/FactoryNotFoundException.java Fri Jul 20 22:41:49 2007
@@ -42,4 +42,14 @@
{
super(msg);
}
+
+ /**
+ * Constructor.
+ *
+ * @param msg Message.
+ * @param e the root cause exception
+ */
+ public FactoryNotFoundException(String msg, Exception e) {
+ super(msg, e);
+ }
}
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesException.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesException.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesException.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesException.java Fri Jul 20 22:41:49 2007
@@ -31,17 +31,11 @@
/**
- * Any "wrapped" exception will be exposed when this is serialized.
- * @serial
- */
- private Exception exception;
- /**
* Constructor.
*/
public TilesException()
{
super();
- this.exception = null;
}
/**
@@ -51,71 +45,40 @@
public TilesException(String message)
{
super(message);
- this.exception = null;
}
/**
* Create a new <code>TilesException</code> wrapping an existing exception.
*
- * <p>The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the TilesException.</p>
- *
- * @param e The exception to be wrapped.
+ * @param e The root cause exception
*/
public TilesException(Exception e)
{
- super();
- this.exception = e;
+ super(e);
}
/**
* Create a new <code>TilesException</code> from an existing exception.
*
- * <p>The existing exception will be embedded in the new
- * one, but the new exception will have its own message.</p>
- *
* @param message The detail message.
- * @param e The exception to be wrapped.
+ * @param e The root cause exception
*/
public TilesException(String message, Exception e)
{
- super(message);
- this.exception = e;
- }
-
-
- /**
- * Return a detail message for this exception.
- *
- * <p>If there is a embedded exception, and if the TilesException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.</p>
- *
- * @return The error or warning message.
- */
- public String getMessage ()
- {
- String message = super.getMessage ();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
+ super(message, e);
}
/**
* Return the embedded exception, if any.
*
- * @return The embedded exception, or <code>null</code> if there is none.
+ * @return The root cause exception, or <code>null</code> if there is none.
*/
public Exception getException ()
{
- return exception;
+ return (Exception) getCause();
}
}
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesPlugin.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesPlugin.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesPlugin.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/TilesPlugin.java Fri Jul 20 22:41:49 2007
@@ -182,7 +182,7 @@
+ getTilesUtilImplClassname()
+ "'. TilesUtil implementation should be a subclass of '"
+ TilesUtilStrutsImpl.class.getName()
- + "'");
+ + "'", ex);
} catch (Exception ex) {
throw new ServletException(
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/taglib/InsertTag.java Fri Jul 20 22:41:49 2007
@@ -577,7 +577,7 @@
+ "'. Check if this name exist in definitions factory.", ex);
} catch (FactoryNotFoundException ex) {
- throw new JspException(ex.getMessage());
+ throw new JspException(ex.getMessage(), ex);
} catch (DefinitionsFactoryException ex) {
if (log.isDebugEnabled()) {
@@ -899,7 +899,7 @@
String msg =
"Can't insert page '" + page + "' : " + e.getMessage();
log.error(msg, e);
- throw new JspException(msg);
+ throw new JspException(msg, e);
} catch (IllegalArgumentException e) {
// Can't resolve page uri, should we ignore it?
Modified: struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java?view=diff&rev=558248&r1=558247&r2=558248
==============================================================================
--- struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java (original)
+++ struts/struts1/trunk/tiles/src/main/java/org/apache/struts/tiles/xmlDefinition/I18nFactorySet.java Fri Jul 20 22:41:49 2007
@@ -196,7 +196,7 @@
} catch (FileNotFoundException ex) { // A filename is specified, throw appropriate error.
log.error(ex.getMessage() + " : Can't find file '" + filename + "'");
throw new FactoryNotFoundException(
- ex.getMessage() + " : Can't find file '" + filename + "'");
+ ex.getMessage() + " : Can't find file '" + filename + "'", ex);
}
} else { // try each default file names