This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository doxia.
commit 523696b7a66259e833d2ded06cbe73d429351aa0 Author: Emmanuel Bourg <[email protected]> Date: Tue Jan 5 17:29:57 2016 +0100 Imported the patch from Fedora fixing the compatibility with FOP 2.0 --- debian/changelog | 7 ++ debian/control | 2 +- debian/patches/0008-fop2-compatibility.patch | 142 +++++++++++++++++++++++++++ debian/patches/series | 1 + 4 files changed, 151 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f69f5d4..ca190e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +doxia (1.1.4-4) UNRELEASED; urgency=medium + + * Team upload. + * Imported the patch from Fedora fixing the compatibility with FOP 2.0 + + -- Emmanuel Bourg <[email protected]> Tue, 05 Jan 2016 16:19:13 +0100 + doxia (1.1.4-3) unstable; urgency=medium * Team upload. diff --git a/debian/control b/debian/control index 34ea4f3..5185c87 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ Build-Depends: cdbs, default-jdk, maven-debian-helper (>= 1.4) Build-Depends-Indep: default-jdk-doc, - fop, + fop (>= 1:2.0), junit, libcommons-configuration-java, libcommons-configuration-java-doc, diff --git a/debian/patches/0008-fop2-compatibility.patch b/debian/patches/0008-fop2-compatibility.patch new file mode 100644 index 0000000..e560190 --- /dev/null +++ b/debian/patches/0008-fop2-compatibility.patch @@ -0,0 +1,142 @@ +Description: Port to fop-2.0 +Author: Michael Simacek <[email protected]> +--- a/doxia-modules/doxia-module-fo/pom.xml ++++ b/doxia-modules/doxia-module-fo/pom.xml +@@ -69,7 +69,7 @@ + <dependency> + <groupId>org.apache.xmlgraphics</groupId> + <artifactId>fop</artifactId> +- <version>0.95</version> ++ <version>2.0</version> + </dependency> + <dependency> + <groupId>log4j</groupId> +--- 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.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.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 @@ + */ + 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 @@ + { + foUserAgent.setCreationDate( new Date() ); + } +- +- convertFO2PDF( fo, pdf, resourceDir, foUserAgent ); + } + + /** +@@ -124,16 +107,13 @@ + * @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 @@ + 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 @@ + } + + /** +- * 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() diff --git a/debian/patches/series b/debian/patches/series index 350fc12..5798a98 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,3 +2,4 @@ 0002-add-version-to-plexus-container-default.patch 0003-switch-to-plexus-component-metadata.patch 0007-disable-plexus-javadoc.patch +0008-fop2-compatibility.patch -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/doxia.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

