From d3ef77c7d66c49c84df92d5863dae49beaeca708 Mon Sep 17 00:00:00 2001 From: Simon Steiner Date: Tue, 5 Mar 2024 12:24:48 +0000 Subject: [PATCH] FOP-3160: Rename util to avoid conflicts with core --- .../src/main/java/org/apache/fop/area/AreaTreeParser.java | 2 +- fop-core/src/main/java/org/apache/fop/fo/FONode.java | 2 +- .../java/org/apache/fop/render/intermediate/IFParser.java | 2 +- .../java/org/apache/fop/util/text/ChoiceFieldPart.java | 5 +++-- .../java/org/apache/fop/util/text/EqualsFieldPart.java | 5 +++-- .../java/org/apache/fop/util/text/GlyphNameFieldPart.java | 4 ++-- .../main/java/org/apache/fop/util/text/HexFieldPart.java | 4 ++-- .../main/java/org/apache/fop/util/text/IfFieldPart.java | 5 +++-- .../java/org/apache/fop/util/text/LocatorFormatter.java | 2 +- ....apache.fop.utils.text.AdvancedMessageFormat$Function} | 0 ....fop.utils.text.AdvancedMessageFormat$ObjectFormatter} | 0 ...ache.fop.utils.text.AdvancedMessageFormat$PartFactory} | 0 .../apache/fop/util/AdvancedMessageFormatTestCase.java | 2 +- .../org/apache/fop/util/XMLResourceBundleTestCase.java | 2 ++ .../apache/fop/visual/AbstractPSPDFBitmapProducer.java | 2 +- .../java/org/apache/fop/visual/BitmapProducerJava2D.java | 2 +- .../main/java/org/apache/fop/events/EventFormatter.java | 8 ++++---- .../org/apache/fop/events/model/EventModelParser.java | 2 +- .../apache/fop/{util => utils}/DefaultErrorListener.java | 2 +- .../org/apache/fop/{util => utils}/XMLResourceBundle.java | 2 +- .../fop/{util => utils}/text/AdvancedMessageFormat.java | 6 +++--- 21 files changed, 32 insertions(+), 27 deletions(-) rename fop-core/src/main/resources/META-INF/services/{org.apache.fop.util.text.AdvancedMessageFormat$Function => org.apache.fop.utils.text.AdvancedMessageFormat$Function} (100%) rename fop-core/src/main/resources/META-INF/services/{org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter => org.apache.fop.utils.text.AdvancedMessageFormat$ObjectFormatter} (100%) rename fop-core/src/main/resources/META-INF/services/{org.apache.fop.util.text.AdvancedMessageFormat$PartFactory => org.apache.fop.utils.text.AdvancedMessageFormat$PartFactory} (100%) rename fop-util/src/main/java/org/apache/fop/{util => utils}/DefaultErrorListener.java (98%) rename fop-util/src/main/java/org/apache/fop/{util => utils}/XMLResourceBundle.java (99%) rename fop-util/src/main/java/org/apache/fop/{util => utils}/text/AdvancedMessageFormat.java (98%) diff --git a/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java b/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java index 587e8e449..ca4e097ef 100644 --- a/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java +++ b/fop-core/src/main/java/org/apache/fop/area/AreaTreeParser.java @@ -87,10 +87,10 @@ import org.apache.fop.util.ColorUtil; import org.apache.fop.util.ContentHandlerFactory; import org.apache.fop.util.ContentHandlerFactoryRegistry; import org.apache.fop.util.ConversionUtils; -import org.apache.fop.util.DefaultErrorListener; import org.apache.fop.util.LanguageTags; import org.apache.fop.util.XMLConstants; import org.apache.fop.util.XMLUtil; +import org.apache.fop.utils.DefaultErrorListener; import static org.apache.fop.fo.Constants.FO_REGION_AFTER; import static org.apache.fop.fo.Constants.FO_REGION_BEFORE; diff --git a/fop-core/src/main/java/org/apache/fop/fo/FONode.java b/fop-core/src/main/java/org/apache/fop/fo/FONode.java index f3c582dd5..c6c8cc3ce 100644 --- a/fop-core/src/main/java/org/apache/fop/fo/FONode.java +++ b/fop-core/src/main/java/org/apache/fop/fo/FONode.java @@ -47,7 +47,7 @@ import org.apache.fop.fo.flow.ChangeBar; import org.apache.fop.fo.pagination.Root; import org.apache.fop.util.CharUtilities; import org.apache.fop.util.ContentHandlerFactory; -import org.apache.fop.util.text.AdvancedMessageFormat.Function; +import org.apache.fop.utils.text.AdvancedMessageFormat.Function; /** * Base class for nodes in the XML tree diff --git a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFParser.java b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFParser.java index a75e61cf3..47529d11a 100644 --- a/fop-core/src/main/java/org/apache/fop/render/intermediate/IFParser.java +++ b/fop-core/src/main/java/org/apache/fop/render/intermediate/IFParser.java @@ -65,9 +65,9 @@ import org.apache.fop.util.ColorUtil; import org.apache.fop.util.ContentHandlerFactory; import org.apache.fop.util.ContentHandlerFactoryRegistry; import org.apache.fop.util.DOMBuilderContentHandlerFactory; -import org.apache.fop.util.DefaultErrorListener; import org.apache.fop.util.LanguageTags; import org.apache.fop.util.XMLUtil; +import org.apache.fop.utils.DefaultErrorListener; /** * This is a parser for the intermediate format XML which converts the intermediate file into diff --git a/fop-core/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java b/fop-core/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java index c87b9c61f..12b47c8ac 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/ChoiceFieldPart.java @@ -24,8 +24,9 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.text.AdvancedMessageFormat; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Defines a "choice" field part that works like {@link ChoiceFormat}. diff --git a/fop-core/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java b/fop-core/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java index 153322f27..bafb9b156 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/EqualsFieldPart.java @@ -21,8 +21,9 @@ package org.apache.fop.util.text; import java.util.Map; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.text.AdvancedMessageFormat; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Defines an "equals" field part that can compare a field's string value against another string. diff --git a/fop-core/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java b/fop-core/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java index 48346c13a..21683b066 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/GlyphNameFieldPart.java @@ -23,8 +23,8 @@ import java.util.Map; import org.apache.xmlgraphics.fonts.Glyphs; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Function formatting a character to a glyph name. diff --git a/fop-core/src/main/java/org/apache/fop/util/text/HexFieldPart.java b/fop-core/src/main/java/org/apache/fop/util/text/HexFieldPart.java index 075adb00f..61affb4ba 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/HexFieldPart.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/HexFieldPart.java @@ -21,8 +21,8 @@ package org.apache.fop.util.text; import java.util.Map; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Function formatting a number or character to a hex value. diff --git a/fop-core/src/main/java/org/apache/fop/util/text/IfFieldPart.java b/fop-core/src/main/java/org/apache/fop/util/text/IfFieldPart.java index 52c06bad1..315b2c0de 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/IfFieldPart.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/IfFieldPart.java @@ -21,8 +21,9 @@ package org.apache.fop.util.text; import java.util.Map; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.text.AdvancedMessageFormat; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Defines an "if" field part that checks if field's value is true or false. diff --git a/fop-core/src/main/java/org/apache/fop/util/text/LocatorFormatter.java b/fop-core/src/main/java/org/apache/fop/util/text/LocatorFormatter.java index 07e7f2aaa..39842610e 100644 --- a/fop-core/src/main/java/org/apache/fop/util/text/LocatorFormatter.java +++ b/fop-core/src/main/java/org/apache/fop/util/text/LocatorFormatter.java @@ -21,7 +21,7 @@ package org.apache.fop.util.text; import org.xml.sax.Locator; -import org.apache.fop.util.text.AdvancedMessageFormat.ObjectFormatter; +import org.apache.fop.utils.text.AdvancedMessageFormat.ObjectFormatter; /** * Object formatter for the SAX Locator object. diff --git a/fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function b/fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$Function similarity index 100% rename from fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$Function rename to fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$Function diff --git a/fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter b/fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$ObjectFormatter similarity index 100% rename from fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$ObjectFormatter rename to fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$ObjectFormatter diff --git a/fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory b/fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$PartFactory similarity index 100% rename from fop-core/src/main/resources/META-INF/services/org.apache.fop.util.text.AdvancedMessageFormat$PartFactory rename to fop-core/src/main/resources/META-INF/services/org.apache.fop.utils.text.AdvancedMessageFormat$PartFactory diff --git a/fop-core/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java b/fop-core/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java index f0d965cd9..3a8712cee 100644 --- a/fop-core/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/util/AdvancedMessageFormatTestCase.java @@ -27,7 +27,7 @@ import org.xml.sax.helpers.LocatorImpl; import static org.junit.Assert.assertEquals; import org.apache.fop.events.model.EventSeverity; -import org.apache.fop.util.text.AdvancedMessageFormat; +import org.apache.fop.utils.text.AdvancedMessageFormat; /** * Tests for EventFormatter. diff --git a/fop-core/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java b/fop-core/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java index 60aa16d83..d67c8da56 100644 --- a/fop-core/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/util/XMLResourceBundleTestCase.java @@ -28,6 +28,8 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.apache.fop.utils.XMLResourceBundle; + /** * Tests for XMLResourceBundle. */ diff --git a/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java index 5edae8074..b6a9147f3 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java +++ b/fop-core/src/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java @@ -40,7 +40,7 @@ import org.apache.fop.apps.FopFactory; import org.apache.fop.configuration.Configurable; import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.ConfigurationException; -import org.apache.fop.util.DefaultErrorListener; +import org.apache.fop.utils.DefaultErrorListener; /** * BitmapProducer implementation that uses the PS or PDF renderer and an external converter diff --git a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java index ae3b097cb..90b810dad 100644 --- a/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java +++ b/fop-core/src/test/java/org/apache/fop/visual/BitmapProducerJava2D.java @@ -39,7 +39,7 @@ import org.apache.fop.apps.MimeConstants; import org.apache.fop.configuration.Configurable; import org.apache.fop.configuration.Configuration; import org.apache.fop.configuration.ConfigurationException; -import org.apache.fop.util.DefaultErrorListener; +import org.apache.fop.utils.DefaultErrorListener; /** * BitmapProducer implementation that uses the Java2DRenderer to create bitmaps. diff --git a/fop-events/src/main/java/org/apache/fop/events/EventFormatter.java b/fop-events/src/main/java/org/apache/fop/events/EventFormatter.java index 7f56c8396..1c1698c4e 100644 --- a/fop-events/src/main/java/org/apache/fop/events/EventFormatter.java +++ b/fop-events/src/main/java/org/apache/fop/events/EventFormatter.java @@ -29,10 +29,10 @@ import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.util.XMLResourceBundle; -import org.apache.fop.util.text.AdvancedMessageFormat; -import org.apache.fop.util.text.AdvancedMessageFormat.Part; -import org.apache.fop.util.text.AdvancedMessageFormat.PartFactory; +import org.apache.fop.utils.XMLResourceBundle; +import org.apache.fop.utils.text.AdvancedMessageFormat; +import org.apache.fop.utils.text.AdvancedMessageFormat.Part; +import org.apache.fop.utils.text.AdvancedMessageFormat.PartFactory; /** * Converts events into human-readable, localized messages. diff --git a/fop-events/src/main/java/org/apache/fop/events/model/EventModelParser.java b/fop-events/src/main/java/org/apache/fop/events/model/EventModelParser.java index 5441d1c4f..7d3b7a03c 100644 --- a/fop-events/src/main/java/org/apache/fop/events/model/EventModelParser.java +++ b/fop-events/src/main/java/org/apache/fop/events/model/EventModelParser.java @@ -35,7 +35,7 @@ import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.fop.util.DefaultErrorListener; +import org.apache.fop.utils.DefaultErrorListener; /** * This is a parser for the event model XML. diff --git a/fop-util/src/main/java/org/apache/fop/util/DefaultErrorListener.java b/fop-util/src/main/java/org/apache/fop/utils/DefaultErrorListener.java similarity index 98% rename from fop-util/src/main/java/org/apache/fop/util/DefaultErrorListener.java rename to fop-util/src/main/java/org/apache/fop/utils/DefaultErrorListener.java index 3c554afc7..64ca98d1b 100644 --- a/fop-util/src/main/java/org/apache/fop/util/DefaultErrorListener.java +++ b/fop-util/src/main/java/org/apache/fop/utils/DefaultErrorListener.java @@ -17,7 +17,7 @@ /* $Id$ */ -package org.apache.fop.util; +package org.apache.fop.utils; import javax.xml.transform.ErrorListener; import javax.xml.transform.TransformerException; diff --git a/fop-util/src/main/java/org/apache/fop/util/XMLResourceBundle.java b/fop-util/src/main/java/org/apache/fop/utils/XMLResourceBundle.java similarity index 99% rename from fop-util/src/main/java/org/apache/fop/util/XMLResourceBundle.java rename to fop-util/src/main/java/org/apache/fop/utils/XMLResourceBundle.java index 80aec2d2f..747284ec4 100644 --- a/fop-util/src/main/java/org/apache/fop/util/XMLResourceBundle.java +++ b/fop-util/src/main/java/org/apache/fop/utils/XMLResourceBundle.java @@ -17,7 +17,7 @@ /* $Id$ */ -package org.apache.fop.util; +package org.apache.fop.utils; import java.io.IOException; import java.io.InputStream; diff --git a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java b/fop-util/src/main/java/org/apache/fop/utils/text/AdvancedMessageFormat.java similarity index 98% rename from fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java rename to fop-util/src/main/java/org/apache/fop/utils/text/AdvancedMessageFormat.java index dafc3741b..5ebf33fcb 100644 --- a/fop-util/src/main/java/org/apache/fop/util/text/AdvancedMessageFormat.java +++ b/fop-util/src/main/java/org/apache/fop/utils/text/AdvancedMessageFormat.java @@ -17,7 +17,7 @@ /* $Id$ */ -package org.apache.fop.util.text; +package org.apache.fop.utils.text; import java.util.Iterator; import java.util.List; @@ -44,7 +44,7 @@ import org.apache.xmlgraphics.util.Service; public class AdvancedMessageFormat { /** Regex that matches "," but not "\," (escaped comma) */ - static final Pattern COMMA_SEPARATOR_REGEX = Pattern.compile("(? PART_FACTORIES = new java.util.HashMap(); @@ -477,7 +477,7 @@ public class AdvancedMessageFormat { } - static String unescapeComma(String string) { + public static String unescapeComma(String string) { return string.replaceAll("\\\\,", ","); } } -- 2.39.5