From 3133a012c156e91876ad60383f9397d038f474a5 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 5 Mar 2024 12:51:05 +0000 Subject: FOP-3160: Rename events to avoid conflicts with events module --- .../main/java/org/apache/fop/apps/FOUserAgent.java | 4 +- .../apache/fop/event/FOPEventListenerProxy.java | 75 +++++++++++++ .../org/apache/fop/event/LoggingEventListener.java | 120 +++++++++++++++++++++ .../apache/fop/event/PropertyExceptionFactory.java | 49 +++++++++ .../UnsupportedOperationExceptionFactory.java | 45 ++++++++ .../fop/event/ValidationExceptionFactory.java | 53 +++++++++ .../main/java/org/apache/fop/event/package.html | 23 ++++ .../apache/fop/events/FOPEventListenerProxy.java | 73 ------------- .../apache/fop/events/LoggingEventListener.java | 117 -------------------- .../fop/events/PropertyExceptionFactory.java | 47 -------- .../UnsupportedOperationExceptionFactory.java | 43 -------- .../fop/events/ValidationExceptionFactory.java | 51 --------- .../main/java/org/apache/fop/events/package.html | 23 ---- ...p.events.EventExceptionManager$ExceptionFactory | 6 +- 14 files changed, 370 insertions(+), 359 deletions(-) create mode 100644 fop-core/src/main/java/org/apache/fop/event/FOPEventListenerProxy.java create mode 100644 fop-core/src/main/java/org/apache/fop/event/LoggingEventListener.java create mode 100644 fop-core/src/main/java/org/apache/fop/event/PropertyExceptionFactory.java create mode 100644 fop-core/src/main/java/org/apache/fop/event/UnsupportedOperationExceptionFactory.java create mode 100644 fop-core/src/main/java/org/apache/fop/event/ValidationExceptionFactory.java create mode 100644 fop-core/src/main/java/org/apache/fop/event/package.html delete mode 100644 fop-core/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java delete mode 100644 fop-core/src/main/java/org/apache/fop/events/LoggingEventListener.java delete mode 100644 fop-core/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java delete mode 100644 fop-core/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java delete mode 100644 fop-core/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java delete mode 100644 fop-core/src/main/java/org/apache/fop/events/package.html (limited to 'fop-core') diff --git a/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java b/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java index 02b0128cd..9fec79bf4 100644 --- a/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java +++ b/fop-core/src/main/java/org/apache/fop/apps/FOUserAgent.java @@ -47,12 +47,12 @@ import org.apache.fop.accessibility.StructureTreeEventHandler; import org.apache.fop.apps.io.InternalResourceResolver; import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.event.FOPEventListenerProxy; +import org.apache.fop.event.LoggingEventListener; import org.apache.fop.events.DefaultEventBroadcaster; import org.apache.fop.events.Event; import org.apache.fop.events.EventBroadcaster; import org.apache.fop.events.EventListener; -import org.apache.fop.events.FOPEventListenerProxy; -import org.apache.fop.events.LoggingEventListener; import org.apache.fop.fo.ElementMappingRegistry; import org.apache.fop.fo.FOEventHandler; import org.apache.fop.fonts.FontManager; diff --git a/fop-core/src/main/java/org/apache/fop/event/FOPEventListenerProxy.java b/fop-core/src/main/java/org/apache/fop/event/FOPEventListenerProxy.java new file mode 100644 index 000000000..310d418b6 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/FOPEventListenerProxy.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.event; + +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.events.Event; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; +import org.apache.fop.fo.FOValidationEventProducer; +import org.apache.fop.layoutmgr.BlockLevelEventProducer; + +/** + * EventListener proxy that inspects all events and adjusts severity levels where necessary. + * For validation events, it reacts on each event based on the strict validation setting in + * the user agent. + * For layout events, it reduces the default severity level if FOP signals that it can recover + * from the event. + */ +public class FOPEventListenerProxy implements EventListener { + + private static final String FOVALIDATION_EVENT_ID_PREFIX + = FOValidationEventProducer.class.getName(); + + private static final String BLOCK_LEVEL_EVENT_ID_PREFIX + = BlockLevelEventProducer.class.getName(); + + private EventListener delegate; + private FOUserAgent userAgent; + + /** + * Main constructor. + * @param delegate the event listener to delegate events to + * @param userAgent the FO user agent + */ + public FOPEventListenerProxy(EventListener delegate, FOUserAgent userAgent) { + this.delegate = delegate; + this.userAgent = userAgent; + } + + /** {@inheritDoc} */ + public synchronized void processEvent(Event event) { + if (event.getEventID().startsWith(FOVALIDATION_EVENT_ID_PREFIX)) { + Boolean canRecover = (Boolean)event.getParam("canRecover"); + if (Boolean.TRUE.equals(canRecover) && !userAgent.validateStrictly()) { + //Reduce severity if FOP can recover + event.setSeverity(EventSeverity.WARN); + } + } else if (event.getEventID().startsWith(BLOCK_LEVEL_EVENT_ID_PREFIX)) { + Boolean canRecover = (Boolean)event.getParam("canRecover"); + if (Boolean.TRUE.equals(canRecover)) { + //Reduce severity if FOP can recover + event.setSeverity(EventSeverity.WARN); + } + } + this.delegate.processEvent(event); + } + +} diff --git a/fop-core/src/main/java/org/apache/fop/event/LoggingEventListener.java b/fop-core/src/main/java/org/apache/fop/event/LoggingEventListener.java new file mode 100644 index 000000000..82d95a78d --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/LoggingEventListener.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.event; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.events.EventListener; +import org.apache.fop.events.model.EventSeverity; + +/** + * EventListener implementation that redirects events to Commons Logging. The events are + * converted to localized messages. + */ +public class LoggingEventListener implements EventListener { + + /** Default logger instance */ + private static Log defaultLog = LogFactory.getLog(LoggingEventListener.class); + + private Log log; + private boolean skipFatal; + + private final Set loggedMessages = new HashSet(); + + /** + * Creates an instance logging to the default log category of this class. + */ + public LoggingEventListener() { + this(defaultLog); + } + + /** + * Creates an instance logging to a given logger. Events with fatal severity level will be + * skipped. + * @param log the target logger + */ + public LoggingEventListener(Log log) { + this(log, true); + } + + /** + * Creates an instance logging to a given logger. + * @param log the target logger + * @param skipFatal true if events with fatal severity level should be skipped (i.e. not logged) + */ + public LoggingEventListener(Log log, boolean skipFatal) { + this.log = log; + this.skipFatal = skipFatal; + } + + /** + * Returns the target logger for this instance. + * @return the target logger + */ + public Log getLog() { + return this.log; + } + + /** {@inheritDoc} */ + public void processEvent(Event event) { + String msg = EventFormatter.format(event); + EventSeverity severity = event.getSeverity(); + if (severity == EventSeverity.INFO) { + log.info(msg); + } else if (severity == EventSeverity.WARN) { + // we want to prevent logging of duplicate messages in situations where they are likely + // to occur; for instance, warning related to layout do not repeat (since line number + // will be different) and as such we do not try to filter them here; on the other hand, + // font related warnings are very likely to repeat and we try to filter them out here; + // the same may happen with missing images (but not implemented yet). + String eventGroupID = event.getEventGroupID(); + if (eventGroupID.equals("org.apache.fop.fonts.FontEventProducer")) { + if (!loggedMessages.contains(msg)) { + loggedMessages.add(msg); + log.warn(msg); + } + } else { + log.warn(msg); + } + } else if (severity == EventSeverity.ERROR) { + if (event.getParam("e") != null) { + log.error(msg, (Throwable)event.getParam("e")); + } else { + log.error(msg); + } + } else if (severity == EventSeverity.FATAL) { + if (!skipFatal) { + if (event.getParam("e") != null) { + log.fatal(msg, (Throwable)event.getParam("e")); + } else { + log.fatal(msg); + } + } + } else { + assert false; + } + } +} diff --git a/fop-core/src/main/java/org/apache/fop/event/PropertyExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/event/PropertyExceptionFactory.java new file mode 100644 index 000000000..bba919509 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/PropertyExceptionFactory.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.event; + +import java.util.Locale; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventExceptionManager.ExceptionFactory; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.fo.expr.PropertyException; + +/** + * Exception factory for {@link PropertyException}. + */ +public class PropertyExceptionFactory implements ExceptionFactory { + + /** {@inheritDoc} */ + public Throwable createException(Event event) { + String msg = EventFormatter.format(event, Locale.ENGLISH); + PropertyException ex = new PropertyException(msg); + if (!Locale.ENGLISH.equals(Locale.getDefault())) { + ex.setLocalizedMessage(EventFormatter.format(event)); + } + return ex; + } + + /** {@inheritDoc} */ + public Class getExceptionClass() { + return PropertyException.class; + } + +} diff --git a/fop-core/src/main/java/org/apache/fop/event/UnsupportedOperationExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/event/UnsupportedOperationExceptionFactory.java new file mode 100644 index 000000000..ccccac097 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/UnsupportedOperationExceptionFactory.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.event; + +import java.util.Locale; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventExceptionManager.ExceptionFactory; +import org.apache.fop.events.EventFormatter; + +/** + * Exception factory for {@link UnsupportedOperationException}. + */ +public class UnsupportedOperationExceptionFactory implements ExceptionFactory { + + /** {@inheritDoc} */ + public Throwable createException(Event event) { + String msg = EventFormatter.format(event, Locale.ENGLISH); + UnsupportedOperationException ex = new UnsupportedOperationException(msg); + return ex; + } + + /** {@inheritDoc} */ + public Class getExceptionClass() { + return UnsupportedOperationException.class; + } + +} diff --git a/fop-core/src/main/java/org/apache/fop/event/ValidationExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/event/ValidationExceptionFactory.java new file mode 100644 index 000000000..c6db9f047 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/ValidationExceptionFactory.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.event; + +import java.util.Locale; + +import org.xml.sax.Locator; + +import org.apache.fop.events.Event; +import org.apache.fop.events.EventExceptionManager.ExceptionFactory; +import org.apache.fop.events.EventFormatter; +import org.apache.fop.fo.ValidationException; + +/** + * Exception factory for {@link ValidationException}. + */ +public class ValidationExceptionFactory implements ExceptionFactory { + + /** {@inheritDoc} */ + public Throwable createException(Event event) { + Locator loc = (Locator)event.getParam("loc"); + String msg = EventFormatter.format(event, Locale.ENGLISH); + ValidationException ex = new ValidationException(msg, loc); + if (!Locale.ENGLISH.equals(Locale.getDefault())) { + ex.setLocalizedMessage(EventFormatter.format(event)); + } + return ex; + } + + /** {@inheritDoc} */ + public Class getExceptionClass() { + return ValidationException.class; + } + + +} diff --git a/fop-core/src/main/java/org/apache/fop/event/package.html b/fop-core/src/main/java/org/apache/fop/event/package.html new file mode 100644 index 000000000..852827182 --- /dev/null +++ b/fop-core/src/main/java/org/apache/fop/event/package.html @@ -0,0 +1,23 @@ + + + +org.apache.fop.event Package + +

Subsystem for reporting events inside FOP to client applications.

+ + \ No newline at end of file diff --git a/fop-core/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java b/fop-core/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java deleted file mode 100644 index d57ef1e15..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/FOPEventListenerProxy.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.events; - -import org.apache.fop.apps.FOUserAgent; -import org.apache.fop.events.model.EventSeverity; -import org.apache.fop.fo.FOValidationEventProducer; -import org.apache.fop.layoutmgr.BlockLevelEventProducer; - -/** - * EventListener proxy that inspects all events and adjusts severity levels where necessary. - * For validation events, it reacts on each event based on the strict validation setting in - * the user agent. - * For layout events, it reduces the default severity level if FOP signals that it can recover - * from the event. - */ -public class FOPEventListenerProxy implements EventListener { - - private static final String FOVALIDATION_EVENT_ID_PREFIX - = FOValidationEventProducer.class.getName(); - - private static final String BLOCK_LEVEL_EVENT_ID_PREFIX - = BlockLevelEventProducer.class.getName(); - - private EventListener delegate; - private FOUserAgent userAgent; - - /** - * Main constructor. - * @param delegate the event listener to delegate events to - * @param userAgent the FO user agent - */ - public FOPEventListenerProxy(EventListener delegate, FOUserAgent userAgent) { - this.delegate = delegate; - this.userAgent = userAgent; - } - - /** {@inheritDoc} */ - public synchronized void processEvent(Event event) { - if (event.getEventID().startsWith(FOVALIDATION_EVENT_ID_PREFIX)) { - Boolean canRecover = (Boolean)event.getParam("canRecover"); - if (Boolean.TRUE.equals(canRecover) && !userAgent.validateStrictly()) { - //Reduce severity if FOP can recover - event.setSeverity(EventSeverity.WARN); - } - } else if (event.getEventID().startsWith(BLOCK_LEVEL_EVENT_ID_PREFIX)) { - Boolean canRecover = (Boolean)event.getParam("canRecover"); - if (Boolean.TRUE.equals(canRecover)) { - //Reduce severity if FOP can recover - event.setSeverity(EventSeverity.WARN); - } - } - this.delegate.processEvent(event); - } - -} diff --git a/fop-core/src/main/java/org/apache/fop/events/LoggingEventListener.java b/fop-core/src/main/java/org/apache/fop/events/LoggingEventListener.java deleted file mode 100644 index 7df05f6d3..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/LoggingEventListener.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.events; - -import java.util.HashSet; -import java.util.Set; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.fop.events.model.EventSeverity; - -/** - * EventListener implementation that redirects events to Commons Logging. The events are - * converted to localized messages. - */ -public class LoggingEventListener implements EventListener { - - /** Default logger instance */ - private static Log defaultLog = LogFactory.getLog(LoggingEventListener.class); - - private Log log; - private boolean skipFatal; - - private final Set loggedMessages = new HashSet(); - - /** - * Creates an instance logging to the default log category of this class. - */ - public LoggingEventListener() { - this(defaultLog); - } - - /** - * Creates an instance logging to a given logger. Events with fatal severity level will be - * skipped. - * @param log the target logger - */ - public LoggingEventListener(Log log) { - this(log, true); - } - - /** - * Creates an instance logging to a given logger. - * @param log the target logger - * @param skipFatal true if events with fatal severity level should be skipped (i.e. not logged) - */ - public LoggingEventListener(Log log, boolean skipFatal) { - this.log = log; - this.skipFatal = skipFatal; - } - - /** - * Returns the target logger for this instance. - * @return the target logger - */ - public Log getLog() { - return this.log; - } - - /** {@inheritDoc} */ - public void processEvent(Event event) { - String msg = EventFormatter.format(event); - EventSeverity severity = event.getSeverity(); - if (severity == EventSeverity.INFO) { - log.info(msg); - } else if (severity == EventSeverity.WARN) { - // we want to prevent logging of duplicate messages in situations where they are likely - // to occur; for instance, warning related to layout do not repeat (since line number - // will be different) and as such we do not try to filter them here; on the other hand, - // font related warnings are very likely to repeat and we try to filter them out here; - // the same may happen with missing images (but not implemented yet). - String eventGroupID = event.getEventGroupID(); - if (eventGroupID.equals("org.apache.fop.fonts.FontEventProducer")) { - if (!loggedMessages.contains(msg)) { - loggedMessages.add(msg); - log.warn(msg); - } - } else { - log.warn(msg); - } - } else if (severity == EventSeverity.ERROR) { - if (event.getParam("e") != null) { - log.error(msg, (Throwable)event.getParam("e")); - } else { - log.error(msg); - } - } else if (severity == EventSeverity.FATAL) { - if (!skipFatal) { - if (event.getParam("e") != null) { - log.fatal(msg, (Throwable)event.getParam("e")); - } else { - log.fatal(msg); - } - } - } else { - assert false; - } - } -} diff --git a/fop-core/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java deleted file mode 100644 index 04f954f98..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/PropertyExceptionFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.events; - -import java.util.Locale; - -import org.apache.fop.events.EventExceptionManager.ExceptionFactory; -import org.apache.fop.fo.expr.PropertyException; - -/** - * Exception factory for {@link PropertyException}. - */ -public class PropertyExceptionFactory implements ExceptionFactory { - - /** {@inheritDoc} */ - public Throwable createException(Event event) { - String msg = EventFormatter.format(event, Locale.ENGLISH); - PropertyException ex = new PropertyException(msg); - if (!Locale.ENGLISH.equals(Locale.getDefault())) { - ex.setLocalizedMessage(EventFormatter.format(event)); - } - return ex; - } - - /** {@inheritDoc} */ - public Class getExceptionClass() { - return PropertyException.class; - } - -} diff --git a/fop-core/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java deleted file mode 100644 index b15dea7c0..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/UnsupportedOperationExceptionFactory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.events; - -import java.util.Locale; - -import org.apache.fop.events.EventExceptionManager.ExceptionFactory; - -/** - * Exception factory for {@link UnsupportedOperationException}. - */ -public class UnsupportedOperationExceptionFactory implements ExceptionFactory { - - /** {@inheritDoc} */ - public Throwable createException(Event event) { - String msg = EventFormatter.format(event, Locale.ENGLISH); - UnsupportedOperationException ex = new UnsupportedOperationException(msg); - return ex; - } - - /** {@inheritDoc} */ - public Class getExceptionClass() { - return UnsupportedOperationException.class; - } - -} diff --git a/fop-core/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java b/fop-core/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java deleted file mode 100644 index 59f952961..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/ValidationExceptionFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.events; - -import java.util.Locale; - -import org.xml.sax.Locator; - -import org.apache.fop.events.EventExceptionManager.ExceptionFactory; -import org.apache.fop.fo.ValidationException; - -/** - * Exception factory for {@link ValidationException}. - */ -public class ValidationExceptionFactory implements ExceptionFactory { - - /** {@inheritDoc} */ - public Throwable createException(Event event) { - Locator loc = (Locator)event.getParam("loc"); - String msg = EventFormatter.format(event, Locale.ENGLISH); - ValidationException ex = new ValidationException(msg, loc); - if (!Locale.ENGLISH.equals(Locale.getDefault())) { - ex.setLocalizedMessage(EventFormatter.format(event)); - } - return ex; - } - - /** {@inheritDoc} */ - public Class getExceptionClass() { - return ValidationException.class; - } - - -} diff --git a/fop-core/src/main/java/org/apache/fop/events/package.html b/fop-core/src/main/java/org/apache/fop/events/package.html deleted file mode 100644 index d2e6d63de..000000000 --- a/fop-core/src/main/java/org/apache/fop/events/package.html +++ /dev/null @@ -1,23 +0,0 @@ - - - -org.apache.fop.events Package - -

Subsystem for reporting events inside FOP to client applications.

- - \ No newline at end of file diff --git a/fop-core/src/main/resources/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory b/fop-core/src/main/resources/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory index 13540a4db..32fae1443 100644 --- a/fop-core/src/main/resources/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory +++ b/fop-core/src/main/resources/META-INF/services/org.apache.fop.events.EventExceptionManager$ExceptionFactory @@ -1,5 +1,5 @@ -org.apache.fop.events.ValidationExceptionFactory -org.apache.fop.events.PropertyExceptionFactory -org.apache.fop.events.UnsupportedOperationExceptionFactory +org.apache.fop.event.ValidationExceptionFactory +org.apache.fop.event.PropertyExceptionFactory +org.apache.fop.event.UnsupportedOperationExceptionFactory org.apache.fop.layoutmgr.LayoutException$LayoutExceptionFactory org.apache.fop.fo.pagination.PageProductionException$PageProductionExceptionFactory -- cgit v1.2.3