You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/03/17 12:03:43 UTC
svn commit: r637835 -
/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
Author: jeremias
Date: Mon Mar 17 04:03:31 2008
New Revision: 637835
URL: http://svn.apache.org/viewvc?rev=637835&view=rev
Log:
Throw a RuntimeException of no other Exception class is specified for an event as a fallback if someone just sets the event severity to FATAL.
Modified:
xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java?rev=637835&r1=637834&r2=637835&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/events/EventExceptionManager.java Mon Mar 17 04:03:31 2008
@@ -41,22 +41,24 @@
}
/**
- * Converts an event into an exception and throws that.
+ * Converts an event into an exception and throws that. If the exception class is null,
+ * a {@link RuntimeException} will be thrown.
* @param event the event to be converted
* @param exceptionClass the exception class to be thrown
* @throws Throwable this happens always
*/
public static void throwException(Event event, String exceptionClass) throws Throwable {
- ExceptionFactory factory = (ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass);
- if (factory != null) {
- throw factory.createException(event);
+ if (exceptionClass != null) {
+ ExceptionFactory factory = (ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass);
+ if (factory != null) {
+ throw factory.createException(event);
+ } else {
+ throw new IllegalArgumentException(
+ "No such ExceptionFactory available: " + exceptionClass);
+ }
} else {
- throw new IllegalArgumentException(
- "No such ExceptionFactory available: " + exceptionClass);
- /*
String msg = EventFormatter.format(event);
throw new RuntimeException(msg);
- */
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org