瀏覽代碼

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.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_ProcessingFeedback@637835 13f79535-47bb-0310-9956-ffa450edef68
Temp_ProcessingFeedback
Jeremias Maerki 16 年之前
父節點
當前提交
2b9e6bc11f
共有 1 個檔案被更改,包括 10 行新增8 行删除
  1. 10
    8
      src/java/org/apache/fop/events/EventExceptionManager.java

+ 10
- 8
src/java/org/apache/fop/events/EventExceptionManager.java 查看文件

@@ -41,22 +41,24 @@ public class EventExceptionManager {
}
/**
* 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);
*/
}
}

Loading…
取消
儲存