diff --git a/.gitignore b/.gitignore index 9a01573..ec1a455 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ maven-doxia-1.1.2.tar.gz /doxia-1.4-source-release.zip /doxia-1.5-source-release.zip /doxia-1.6-source-release.zip +/doxia-1.7-source-release.zip diff --git a/0001-Fix-itext-dependency.patch b/0001-Fix-itext-dependency.patch index e2b137c..8a40277 100644 --- a/0001-Fix-itext-dependency.patch +++ b/0001-Fix-itext-dependency.patch @@ -1,7 +1,7 @@ -From 1f2f116f430d3ecf215f092518c73dd84d33ced0 Mon Sep 17 00:00:00 2001 +From 71a78088dff0081a290a860a184166bf993d04bf Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Mon, 29 Apr 2013 11:37:12 +0200 -Subject: [PATCH 1/5] Fix itext dependency +Subject: [PATCH 1/4] Fix itext dependency --- doxia-modules/doxia-module-itext/pom.xml | 2 +- @@ -12,7 +12,7 @@ Subject: [PATCH 1/5] Fix itext dependency 5 files changed, 13 insertions(+), 102 deletions(-) diff --git a/doxia-modules/doxia-module-itext/pom.xml b/doxia-modules/doxia-module-itext/pom.xml -index 86acc37..9cc34ff 100644 +index 94f94f3..8293f04 100644 --- a/doxia-modules/doxia-module-itext/pom.xml +++ b/doxia-modules/doxia-module-itext/pom.xml @@ -58,7 +58,7 @@ under the License. @@ -86,10 +86,10 @@ index 2cc8ef1..5dfc882 100644 /** diff --git a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java -index 7c1da55..9561f8e 100644 +index 2847413..c85f81f 100644 --- a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java +++ b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java -@@ -1231,9 +1231,9 @@ public class ITextSink +@@ -1232,9 +1232,9 @@ public class ITextSink try { Image image = Image.getInstance( new URL( urlName ) ); @@ -195,7 +195,7 @@ index 4363413..141646c 100644 - } } diff --git a/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java b/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java -index 3e24d07..50d0d70 100644 +index 6bcd2be..a9674a0 100644 --- a/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java +++ b/doxia-modules/doxia-module-itext/src/test/java/org/apache/maven/doxia/module/itext/ITextSinkTestCase.java @@ -81,20 +81,6 @@ public class ITextSinkTestCase @@ -241,5 +241,5 @@ index 3e24d07..50d0d70 100644 } } -- -2.1.0 +2.5.5 diff --git a/0002-Update-to-Plexus-Container-1.5.5.patch b/0002-Update-to-Plexus-Container-1.5.5.patch index a338268..3a208ca 100644 --- a/0002-Update-to-Plexus-Container-1.5.5.patch +++ b/0002-Update-to-Plexus-Container-1.5.5.patch @@ -1,23 +1,23 @@ -From 96c7615ae82ed30cfb93225bd9f983a8efa1c74e Mon Sep 17 00:00:00 2001 +From 6a3583cafd46194b6c2c5f4db061f72f16d014ef Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Wed, 6 Nov 2013 12:46:26 +0100 -Subject: [PATCH 2/5] Update to Plexus Container 1.5.5 +Subject: [PATCH 2/4] Update to Plexus Container 1.5.5 --- - .../java/org/apache/maven/doxia/module/AbstractIdentityTest.java | 3 ++- - .../test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java | 3 ++- - .../test/java/org/apache/maven/doxia/xsd/AbstractXmlValidator.java | 3 ++- - pom.xml | 7 +------ - 4 files changed, 7 insertions(+), 9 deletions(-) + .../java/org/apache/maven/doxia/module/AbstractIdentityTest.java | 3 ++- + .../test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java | 5 +++-- + .../test/java/org/apache/maven/doxia/xsd/AbstractXmlValidator.java | 3 ++- + pom.xml | 2 +- + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java -index 100add3..8c78956 100644 +index 2f4f495..540461d 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java +++ b/doxia-core/src/test/java/org/apache/maven/doxia/module/AbstractIdentityTest.java @@ -33,6 +33,7 @@ import org.apache.maven.doxia.parser.Parser; import org.apache.maven.doxia.sink.Sink; - import org.apache.maven.doxia.sink.SinkTestDocument; - import org.apache.maven.doxia.sink.TextSink; + import org.apache.maven.doxia.sink.impl.SinkTestDocument; + import org.apache.maven.doxia.sink.impl.TextSink; +import org.codehaus.plexus.DefaultPlexusContainer; import org.codehaus.plexus.util.IOUtil; @@ -31,19 +31,19 @@ index 100add3..8c78956 100644 parser.parse( reader, sink ); String actual = writer.toString(); -diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -index 93d0f01..5e817d6 100644 ---- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -@@ -25,6 +25,7 @@ import java.io.Writer; - - import org.apache.maven.doxia.AbstractModuleTest; - import org.apache.maven.doxia.logging.PlexusLoggerWrapper; +diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java +index a67a114..3ac8734 100644 +--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java ++++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java +@@ -28,6 +28,7 @@ import org.apache.maven.doxia.logging.PlexusLoggerWrapper; + import org.apache.maven.doxia.sink.Sink; + import org.apache.maven.doxia.sink.SinkEventAttributes; + import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; +import org.codehaus.plexus.DefaultPlexusContainer; import org.codehaus.plexus.util.IOUtil; import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; -@@ -56,7 +57,7 @@ public abstract class AbstractSinkTest +@@ -59,7 +60,7 @@ public abstract class AbstractSinkTest testWriter.reset(); sink = createSink( testWriter ); @@ -52,6 +52,15 @@ index 93d0f01..5e817d6 100644 } /** +@@ -809,7 +810,7 @@ public abstract class AbstractSinkTest + + testWriter.reset(); + sink = createSink( testWriter ); +- sink.enableLogging( new PlexusLoggerWrapper( getContainer().getLogger() ) ); ++ sink.enableLogging( new PlexusLoggerWrapper( ( ( DefaultPlexusContainer )getContainer() ).getLogger() )); + + comment = "-"; + sink.comment( comment ); diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidator.java b/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidator.java index 5f9108e..88db2b4 100644 --- a/doxia-core/src/test/java/org/apache/maven/doxia/xsd/AbstractXmlValidator.java @@ -74,10 +83,10 @@ index 5f9108e..88db2b4 100644 for ( Iterator> it = getTestDocuments().entrySet().iterator(); it.hasNext(); ) { diff --git a/pom.xml b/pom.xml -index 4d42f3e..a0dbb9c 100644 +index 134f8b8..fcf4f32 100644 --- a/pom.xml +++ b/pom.xml -@@ -287,18 +287,13 @@ under the License. +@@ -180,7 +180,7 @@ under the License. org.codehaus.plexus plexus-container-default @@ -86,17 +95,6 @@ index 4d42f3e..a0dbb9c 100644 org.codehaus.plexus - plexus-utils - 3.0.15 - -- -- org.codehaus.plexus -- plexus-component-annotations -- 1.5.5 -- - - - -- -2.1.0 +2.5.5 diff --git a/0003-Disable-tests-which-rely-on-ordering-in-set.patch b/0003-Disable-tests-which-rely-on-ordering-in-set.patch new file mode 100644 index 0000000..3e69d59 --- /dev/null +++ b/0003-Disable-tests-which-rely-on-ordering-in-set.patch @@ -0,0 +1,61 @@ +From 6e1707a4bdea698f62fac215b6bca646bf14e4b4 Mon Sep 17 00:00:00 2001 +From: Michal Srb +Date: Wed, 26 Mar 2014 09:58:20 +0100 +Subject: [PATCH 3/4] Disable tests which rely on ordering in set + +--- + .../test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java | 3 +++ + .../java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java +index 3ac8734..707cdf1 100644 +--- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java ++++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/impl/AbstractSinkTest.java +@@ -452,6 +452,7 @@ public abstract class AbstractSinkTest + * invoked on the current sink, produces the same result as + * {@link #getFigureBlock getFigureBlock}( source, caption ). + */ ++ /* + public void testFigure() throws Exception + { + String source = "figure.jpg"; +@@ -511,6 +512,7 @@ public abstract class AbstractSinkTest + * invoked on the current sink, produces the same result as + * {@link #getTableBlock getTableBlock}( cell, caption ). + */ ++ /* + public void testTable() throws Exception + { + String cell = "cell"; +@@ -544,6 +546,7 @@ public abstract class AbstractSinkTest + assertEquals( "Wrong table!", expected, actual ); + } + } ++ */ + + /** + * Checks that the sequence [paragraph(), text( text ), +diff --git a/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java b/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java +index 847c341..729357b 100644 +--- a/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java ++++ b/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java +@@ -164,6 +164,7 @@ public class FoAggregateSinkTest + /** + * Test of figureGraphics method, of class FoAggregateSink. + */ ++ /* + public void testFigureGraphics() throws Exception + { + try +@@ -187,6 +188,7 @@ public class FoAggregateSinkTest + Diff diff = XMLUnit.compareXML( wrapXml( expected ), wrapXml( actual ) ); + assertTrue( "Wrong figure!", diff.identical() ); + } ++ */ + + /** + * Test of anchor method, of class FoAggregateSink. +-- +2.5.5 + diff --git a/0003-Update-to-Commons-Collections-1.10.patch b/0003-Update-to-Commons-Collections-1.10.patch deleted file mode 100644 index 72bd0f7..0000000 --- a/0003-Update-to-Commons-Collections-1.10.patch +++ /dev/null @@ -1,32 +0,0 @@ -From be1b2b36cd943cb27e85d4850bf37590a0056822 Mon Sep 17 00:00:00 2001 -From: Mikolaj Izdebski -Date: Thu, 7 Nov 2013 08:24:01 +0100 -Subject: [PATCH 3/5] Update to Commons Collections 1.10 - ---- - doxia-modules/doxia-module-fo/pom.xml | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/doxia-modules/doxia-module-fo/pom.xml b/doxia-modules/doxia-module-fo/pom.xml -index 6d54eba..0d89e4f 100644 ---- a/doxia-modules/doxia-module-fo/pom.xml -+++ b/doxia-modules/doxia-module-fo/pom.xml -@@ -73,7 +73,14 @@ under the License. - - commons-configuration - commons-configuration -- 1.6 -+ 1.10 -+ -+ -+ commons-collections -+ commons-collections -+ 3.2.1 -+ -+ runtime - - - org.apache.xmlgraphics --- -2.1.0 - diff --git a/0004-Disable-tests-which-rely-on-ordering-in-set.patch b/0004-Disable-tests-which-rely-on-ordering-in-set.patch deleted file mode 100644 index 1458da3..0000000 --- a/0004-Disable-tests-which-rely-on-ordering-in-set.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 143c842ab8a83f3955abde5e5ca98837d4c3a568 Mon Sep 17 00:00:00 2001 -From: Michal Srb -Date: Wed, 26 Mar 2014 09:58:20 +0100 -Subject: [PATCH 4/5] Disable tests which rely on ordering in set - -These tests fail with Java 8 ---- - .../src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java | 4 ++++ - .../java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java | 2 ++ - 2 files changed, 6 insertions(+) - -diff --git a/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java b/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -index 5e817d6..7439cd3 100644 ---- a/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -+++ b/doxia-core/src/test/java/org/apache/maven/doxia/sink/AbstractSinkTest.java -@@ -419,6 +419,7 @@ public abstract class AbstractSinkTest - * invoked on the current sink, produces the same result as - * {@link #getFigureBlock getFigureBlock}( source, caption ). - */ -+ /* - public void testFigure() throws Exception - { - String source = "figure.jpg"; -@@ -469,6 +470,7 @@ public abstract class AbstractSinkTest - assertEquals( "Wrong figure!", expected, actual ); - } - } -+ */ - - /** - * Checks that the sequence [table(), -@@ -478,6 +480,7 @@ public abstract class AbstractSinkTest - * invoked on the current sink, produces the same result as - * {@link #getTableBlock getTableBlock}( cell, caption ). - */ -+ /* - public void testTable() throws Exception - { - String cell = "cell"; -@@ -511,6 +514,7 @@ public abstract class AbstractSinkTest - assertEquals( "Wrong table!", expected, actual ); - } - } -+ */ - - /** - * Checks that the sequence [paragraph(), text( text ), -diff --git a/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java b/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java -index 847c341..729357b 100644 ---- a/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java -+++ b/doxia-modules/doxia-module-fo/src/test/java/org/apache/maven/doxia/module/fo/FoAggregateSinkTest.java -@@ -164,6 +164,7 @@ public class FoAggregateSinkTest - /** - * Test of figureGraphics method, of class FoAggregateSink. - */ -+ /* - public void testFigureGraphics() throws Exception - { - try -@@ -187,6 +188,7 @@ public class FoAggregateSinkTest - Diff diff = XMLUnit.compareXML( wrapXml( expected ), wrapXml( actual ) ); - assertTrue( "Wrong figure!", diff.identical() ); - } -+ */ - - /** - * Test of anchor method, of class FoAggregateSink. --- -2.1.0 - diff --git a/0004-Port-to-fop-2.0.patch b/0004-Port-to-fop-2.0.patch new file mode 100644 index 0000000..c09b624 --- /dev/null +++ b/0004-Port-to-fop-2.0.patch @@ -0,0 +1,157 @@ +From b72bf32dbabf4c18cf48bdbc344227fb0b2d5110 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 17 Aug 2015 17:15:05 +0200 +Subject: [PATCH 4/4] Port to fop-2.0 + +--- + doxia-modules/doxia-module-fo/pom.xml | 2 +- + .../org/apache/maven/doxia/module/fo/FoUtils.java | 58 ++++++---------------- + 2 files changed, 16 insertions(+), 44 deletions(-) + +diff --git a/doxia-modules/doxia-module-fo/pom.xml b/doxia-modules/doxia-module-fo/pom.xml +index e66c736..6d261c8 100644 +--- a/doxia-modules/doxia-module-fo/pom.xml ++++ b/doxia-modules/doxia-module-fo/pom.xml +@@ -85,7 +85,7 @@ under the License. + + org.apache.xmlgraphics + fop +- 0.95 ++ 2.0 + + + log4j +diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java +index 0e7efc1..c398eaf 100644 +--- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java ++++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java +@@ -24,6 +24,7 @@ import java.io.File; + import java.io.FileOutputStream; + import java.io.IOException; + import java.io.OutputStream; ++import java.net.URI; + import java.util.Date; + + import javax.xml.transform.Result; +@@ -38,6 +39,7 @@ import org.apache.fop.apps.FOPException; + import org.apache.fop.apps.FOUserAgent; + import org.apache.fop.apps.Fop; + import org.apache.fop.apps.FopFactory; ++import org.apache.fop.apps.FopFactoryBuilder; + import org.apache.fop.apps.MimeConstants; + import org.apache.maven.doxia.document.DocumentModel; + import org.codehaus.plexus.util.IOUtil; +@@ -52,28 +54,11 @@ import org.codehaus.plexus.util.StringUtils; + */ + public class FoUtils + { +- /** To reuse the FopFactory **/ +- private static final FopFactory FOP_FACTORY = FopFactory.newInstance(); +- + /** To reuse the TransformerFactory **/ + private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); + +- /** +- * Converts an FO file to a PDF file using FOP. +- * +- * @param fo the FO file, not null. +- * @param pdf the target PDF file, not null. +- * @param resourceDir The base directory for relative path resolution, could be null. +- * If null, defaults to the parent directory of fo. +- * @param documentModel the document model to add PDF metadatas like author, title and keywords, could be null. +- * @throws javax.xml.transform.TransformerException In case of a conversion problem. +- * @since 1.1.1 +- */ +- public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel ) +- throws TransformerException +- { +- FOUserAgent foUserAgent = getDefaultUserAgent( fo, resourceDir ); + ++ private static void prepareUserAgent( FOUserAgent foUserAgent, DocumentModel documentModel ) { + if ( documentModel != null && documentModel.getMeta() != null ) + { + // http://xmlgraphics.apache.org/fop/embedding.html#user-agent +@@ -113,8 +98,6 @@ public class FoUtils + { + foUserAgent.setCreationDate( new Date() ); + } +- +- convertFO2PDF( fo, pdf, resourceDir, foUserAgent ); + } + + /** +@@ -124,16 +107,13 @@ public class FoUtils + * @param pdf the target PDF file, not null. + * @param resourceDir The base directory for relative path resolution, could be null. + * If null, defaults to the parent directory of fo. +- * @param foUserAgent the FOUserAgent to use. +- * May be null, in which case a default user agent will be used. ++ * @param documentModel the document model to add PDF metadatas like author, title and keywords, could be null. + * @throws javax.xml.transform.TransformerException In case of a conversion problem. + * @since 1.1.1 + */ +- public static void convertFO2PDF( File fo, File pdf, String resourceDir, FOUserAgent foUserAgent ) ++ public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel ) + throws TransformerException + { +- FOUserAgent userAgent = ( foUserAgent == null ? getDefaultUserAgent( fo, resourceDir ) : foUserAgent ); +- + OutputStream out = null; + try + { +@@ -149,7 +129,11 @@ public class FoUtils + Result res = null; + try + { +- Fop fop = FOP_FACTORY.newFop( MimeConstants.MIME_PDF, userAgent, out ); ++ URI baseURI = getBaseURI( fo, resourceDir ); ++ FopFactory fopFactory = new FopFactoryBuilder( baseURI ).build(); ++ FOUserAgent userAgent = fopFactory.newFOUserAgent(); ++ prepareUserAgent( userAgent, documentModel ); ++ Fop fop = fopFactory.newFop( MimeConstants.MIME_PDF, userAgent, out ); + res = new SAXResult( fop.getDefaultHandler() ); + } + catch ( FOPException e ) +@@ -193,34 +177,22 @@ public class FoUtils + } + + /** +- * Returns a base URL to be used by the FOUserAgent. ++ * Returns a base URI. + * + * @param fo the FO file. + * @param resourceDir the resource directory. +- * @return String. ++ * @return URI. + */ +- private static String getBaseURL( File fo, String resourceDir ) ++ private static URI getBaseURI( File fo, String resourceDir ) + { +- String url = null; +- + if ( resourceDir == null ) + { +- url = "file:///" + fo.getParent() + "/"; ++ return fo.getParentFile().toURI(); + } + else + { +- url = "file:///" + resourceDir + "/"; ++ return new File( resourceDir + "/" ).toURI(); + } +- +- return url; +- } +- +- private static FOUserAgent getDefaultUserAgent( File fo, String resourceDir ) +- { +- FOUserAgent foUserAgent = FOP_FACTORY.newFOUserAgent(); +- foUserAgent.setBaseURL( getBaseURL( fo, resourceDir ) ); +- +- return foUserAgent; + } + + private FoUtils() +-- +2.5.5 + diff --git a/0005-Port-to-fop-2.0.patch b/0005-Port-to-fop-2.0.patch deleted file mode 100644 index fc53df1..0000000 --- a/0005-Port-to-fop-2.0.patch +++ /dev/null @@ -1,157 +0,0 @@ -From 2c4cc792744d6a7790d73e419220938bca12b8c2 Mon Sep 17 00:00:00 2001 -From: Michael Simacek -Date: Mon, 17 Aug 2015 17:15:05 +0200 -Subject: [PATCH 5/5] Port to fop-2.0 - ---- - doxia-modules/doxia-module-fo/pom.xml | 2 +- - .../org/apache/maven/doxia/module/fo/FoUtils.java | 58 ++++++---------------- - 2 files changed, 16 insertions(+), 44 deletions(-) - -diff --git a/doxia-modules/doxia-module-fo/pom.xml b/doxia-modules/doxia-module-fo/pom.xml -index 0d89e4f..2897eb3 100644 ---- a/doxia-modules/doxia-module-fo/pom.xml -+++ b/doxia-modules/doxia-module-fo/pom.xml -@@ -85,7 +85,7 @@ under the License. - - org.apache.xmlgraphics - fop -- 0.95 -+ 2.0 - - - log4j -diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java -index 0e7efc1..c398eaf 100644 ---- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java -+++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoUtils.java -@@ -24,6 +24,7 @@ import java.io.File; - import java.io.FileOutputStream; - import java.io.IOException; - import java.io.OutputStream; -+import java.net.URI; - import java.util.Date; - - import javax.xml.transform.Result; -@@ -38,6 +39,7 @@ import org.apache.fop.apps.FOPException; - import org.apache.fop.apps.FOUserAgent; - import org.apache.fop.apps.Fop; - import org.apache.fop.apps.FopFactory; -+import org.apache.fop.apps.FopFactoryBuilder; - import org.apache.fop.apps.MimeConstants; - import org.apache.maven.doxia.document.DocumentModel; - import org.codehaus.plexus.util.IOUtil; -@@ -52,28 +54,11 @@ import org.codehaus.plexus.util.StringUtils; - */ - public class FoUtils - { -- /** To reuse the FopFactory **/ -- private static final FopFactory FOP_FACTORY = FopFactory.newInstance(); -- - /** To reuse the TransformerFactory **/ - private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance(); - -- /** -- * Converts an FO file to a PDF file using FOP. -- * -- * @param fo the FO file, not null. -- * @param pdf the target PDF file, not null. -- * @param resourceDir The base directory for relative path resolution, could be null. -- * If null, defaults to the parent directory of fo. -- * @param documentModel the document model to add PDF metadatas like author, title and keywords, could be null. -- * @throws javax.xml.transform.TransformerException In case of a conversion problem. -- * @since 1.1.1 -- */ -- public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel ) -- throws TransformerException -- { -- FOUserAgent foUserAgent = getDefaultUserAgent( fo, resourceDir ); - -+ private static void prepareUserAgent( FOUserAgent foUserAgent, DocumentModel documentModel ) { - if ( documentModel != null && documentModel.getMeta() != null ) - { - // http://xmlgraphics.apache.org/fop/embedding.html#user-agent -@@ -113,8 +98,6 @@ public class FoUtils - { - foUserAgent.setCreationDate( new Date() ); - } -- -- convertFO2PDF( fo, pdf, resourceDir, foUserAgent ); - } - - /** -@@ -124,16 +107,13 @@ public class FoUtils - * @param pdf the target PDF file, not null. - * @param resourceDir The base directory for relative path resolution, could be null. - * If null, defaults to the parent directory of fo. -- * @param foUserAgent the FOUserAgent to use. -- * May be null, in which case a default user agent will be used. -+ * @param documentModel the document model to add PDF metadatas like author, title and keywords, could be null. - * @throws javax.xml.transform.TransformerException In case of a conversion problem. - * @since 1.1.1 - */ -- public static void convertFO2PDF( File fo, File pdf, String resourceDir, FOUserAgent foUserAgent ) -+ public static void convertFO2PDF( File fo, File pdf, String resourceDir, DocumentModel documentModel ) - throws TransformerException - { -- FOUserAgent userAgent = ( foUserAgent == null ? getDefaultUserAgent( fo, resourceDir ) : foUserAgent ); -- - OutputStream out = null; - try - { -@@ -149,7 +129,11 @@ public class FoUtils - Result res = null; - try - { -- Fop fop = FOP_FACTORY.newFop( MimeConstants.MIME_PDF, userAgent, out ); -+ URI baseURI = getBaseURI( fo, resourceDir ); -+ FopFactory fopFactory = new FopFactoryBuilder( baseURI ).build(); -+ FOUserAgent userAgent = fopFactory.newFOUserAgent(); -+ prepareUserAgent( userAgent, documentModel ); -+ Fop fop = fopFactory.newFop( MimeConstants.MIME_PDF, userAgent, out ); - res = new SAXResult( fop.getDefaultHandler() ); - } - catch ( FOPException e ) -@@ -193,34 +177,22 @@ public class FoUtils - } - - /** -- * Returns a base URL to be used by the FOUserAgent. -+ * Returns a base URI. - * - * @param fo the FO file. - * @param resourceDir the resource directory. -- * @return String. -+ * @return URI. - */ -- private static String getBaseURL( File fo, String resourceDir ) -+ private static URI getBaseURI( File fo, String resourceDir ) - { -- String url = null; -- - if ( resourceDir == null ) - { -- url = "file:///" + fo.getParent() + "/"; -+ return fo.getParentFile().toURI(); - } - else - { -- url = "file:///" + resourceDir + "/"; -+ return new File( resourceDir + "/" ).toURI(); - } -- -- return url; -- } -- -- private static FOUserAgent getDefaultUserAgent( File fo, String resourceDir ) -- { -- FOUserAgent foUserAgent = FOP_FACTORY.newFOUserAgent(); -- foUserAgent.setBaseURL( getBaseURL( fo, resourceDir ) ); -- -- return foUserAgent; - } - - private FoUtils() --- -2.1.0 - diff --git a/maven-doxia.spec b/maven-doxia.spec index 5a1ba96..a190736 100644 --- a/maven-doxia.spec +++ b/maven-doxia.spec @@ -4,8 +4,8 @@ %endif Name: maven-doxia -Version: 1.6 -Release: 5%{?dist} +Version: 1.7 +Release: 1%{?dist} Epoch: 0 Summary: Content generation framework License: ASL 2.0 @@ -20,14 +20,11 @@ Patch1: 0001-Fix-itext-dependency.patch # Forwarded upstream: DOXIA-504 Patch2: 0002-Update-to-Plexus-Container-1.5.5.patch -# Accepted upstream: DOXIA-505 -Patch3: 0003-Update-to-Commons-Collections-1.10.patch - # Don't run bad tests which rely on ordering in set (they fail with Java 8) -Patch4: 0004-Disable-tests-which-rely-on-ordering-in-set.patch +Patch3: 0003-Disable-tests-which-rely-on-ordering-in-set.patch # Not upstreamable due to higher Java version of fop's dependencies -Patch5: 0005-Port-to-fop-2.0.patch +Patch4: 0004-Port-to-fop-2.0.patch BuildArch: noarch @@ -199,16 +196,21 @@ API documentation for %{name}. %patch2 -p1 %patch3 -p1 %patch4 -p1 -%patch5 -p1 # we don't have clirr-maven-plugin %pom_remove_plugin org.codehaus.mojo:clirr-maven-plugin pom.xml +# complains +%pom_remove_plugin :apache-rat-plugin + # use java 5 generics in modello plugin %pom_xpath_inject "pom:plugin[pom:artifactId[text()='modello-maven-plugin']]"\ "/pom:executions/pom:execution/pom:configuration" \ "true" doxia-modules/doxia-module-fml/pom.xml +# requires network +rm doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java + %mvn_package :::tests: tests %if %{without itext} @@ -257,6 +259,9 @@ API documentation for %{name}. %changelog +* Mon May 02 2016 Michael Simacek - 0:1.7-1 +- Update to upstream version 1.7 + * Thu Feb 04 2016 Fedora Release Engineering - 0:1.6-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index 393930a..81db8de 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -a1a327bd252f5bf634381d87da7d3797 doxia-1.6-source-release.zip +309db839b0828aa6f32b80fd6506fbd0 doxia-1.7-source-release.zip