Author: chris.laprun(a)jboss.com
Date: 2010-10-02 12:14:42 -0400 (Sat, 02 Oct 2010)
New Revision: 4469
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java
Log:
- Improved error message creation, hopefully.
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2010-10-02
16:03:25 UTC (rev 4468)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/BeanContext.java 2010-10-02
16:14:42 UTC (rev 4469)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -71,8 +71,9 @@
* @param target
* @param message
* @param severity
+ * @param additionalParams
*/
- protected abstract void createMessage(String target, String message, Object
severity);
+ protected abstract void createMessage(String target, String message, Object severity,
Object... additionalParams);
protected abstract Object getErrorSeverity();
@@ -152,10 +153,10 @@
*/
public void createErrorMessageFrom(String target, Exception e)
{
- Throwable cause = e.getCause();
+// Throwable cause = e.getCause();
String localizedMessage = getLocalizedMessageOrExceptionName(e);
- String message = localizedMessage + (cause != null ? "\n" +
getMessageFromBundle(CAUSE) + getLocalizedMessageOrExceptionName(cause) : "");
- createMessage(target, message, getErrorSeverity());
+// String message = localizedMessage + (cause != null ? "\n" +
getMessageFromBundle(CAUSE) + getLocalizedMessageOrExceptionName(cause) : "");
+ createMessage(target, localizedMessage, getErrorSeverity(), e.getCause());
}
/**
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2010-10-02
16:03:25 UTC (rev 4468)
+++
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2010-10-02
16:14:42 UTC (rev 4469)
@@ -1,6 +1,6 @@
/*
* JBoss, a division of Red Hat
- * Copyright 2009, Red Hat Middleware, LLC, and individual
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
* contributors as indicated by the @authors tag. See the
* copyright.txt in the distribution for a full listing of
* individual contributors.
@@ -60,12 +60,12 @@
return facesContext.getExternalContext().getSessionMap();
}
- protected void createMessage(String target, String message, Object severity)
+ protected void createMessage(String target, String message, Object severity, Object...
additionalParams)
{
outputMessage(target, message, severity);
}
- public static void outputMessage(String target, String message, Object severity)
+ public static void outputMessage(String target, String message, Object severity,
Object... additionalParams)
{
if (ParameterValidation.isNullOrEmpty(target))
{
@@ -96,7 +96,12 @@
log.info("Couldn't resolve component target: " + target);
}
- FacesMessage msg = new FacesMessage(jsfSeverity, message, message);
+ String details = message;
+ if (additionalParams != null && additionalParams.length > 0)
+ {
+ details = ((Exception)additionalParams[0]).getLocalizedMessage();
+ }
+ FacesMessage msg = new FacesMessage(jsfSeverity, message, details);
facesContext.addMessage(target, msg);
}
Modified:
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java
===================================================================
---
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java 2010-10-02
16:03:25 UTC (rev 4468)
+++
components/wsrp/trunk/admin-gui/src/test/java/org/gatein/wsrp/other/ConsumerBeanTestCase.java 2010-10-02
16:14:42 UTC (rev 4469)
@@ -131,7 +131,7 @@
throw new NotYetImplemented();
}
- protected void createMessage(String target, String message, Object severity)
+ protected void createMessage(String target, String message, Object severity,
Object... addtionalParams)
{
// ignore for tests
}