diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-03-16 11:44:09 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-03-16 11:44:09 +0000 |
commit | 0e6c4648996b5bfd38330129fcdfaaa72f86b09c (patch) | |
tree | 38dbbb164c5e355841f7c853e3986816f18bcbee /src/java/org/apache/fop/events | |
parent | 8661b3a84d3c71a10bba467d5575687c21da25ba (diff) | |
download | xmlgraphics-fop-0e6c4648996b5bfd38330129fcdfaaa72f86b09c.tar.gz xmlgraphics-fop-0e6c4648996b5bfd38330129fcdfaaa72f86b09c.zip |
Bugzila#52849: SVG font being painted as shapes when font present in the system
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1301445 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/events')
-rw-r--r-- | src/java/org/apache/fop/events/LoggingEventListener.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/events/LoggingEventListener.java b/src/java/org/apache/fop/events/LoggingEventListener.java index 58fbb7f97..7df05f6d3 100644 --- a/src/java/org/apache/fop/events/LoggingEventListener.java +++ b/src/java/org/apache/fop/events/LoggingEventListener.java @@ -19,6 +19,9 @@ 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; @@ -36,6 +39,8 @@ public class LoggingEventListener implements EventListener { private Log log; private boolean skipFatal; + private final Set<String> loggedMessages = new HashSet<String>(); + /** * Creates an instance logging to the default log category of this class. */ @@ -77,7 +82,20 @@ public class LoggingEventListener implements EventListener { if (severity == EventSeverity.INFO) { log.info(msg); } else if (severity == EventSeverity.WARN) { - log.warn(msg); + // 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")); @@ -96,5 +114,4 @@ public class LoggingEventListener implements EventListener { assert false; } } - } |