Fridrich Strba 2023-09-23 09:21:13 +00:00 committed by Git OBS Bridge
parent f8b253d712
commit cb844176fe
6 changed files with 85 additions and 264 deletions

View File

@ -1,245 +0,0 @@
From 71a78088dff0081a290a860a184166bf993d04bf Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky@redhat.com>
Date: Mon, 29 Apr 2013 11:37:12 +0200
Subject: [PATCH 1/4] Fix itext dependency
---
doxia-modules/doxia-module-itext/pom.xml | 2 +-
.../apache/maven/doxia/module/itext/ITextFont.java | 16 ++---
.../apache/maven/doxia/module/itext/ITextSink.java | 6 +-
.../apache/maven/doxia/module/itext/ITextUtil.java | 69 +---------------------
.../doxia/module/itext/ITextSinkTestCase.java | 22 -------
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 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.
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
- <version>1.4</version>
+ <version>2.1.7</version>
</dependency>
</dependencies>
diff --git a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextFont.java b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextFont.java
index 2cc8ef1..5dfc882 100644
--- a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextFont.java
+++ b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextFont.java
@@ -24,7 +24,7 @@ import java.awt.Color;
import com.lowagie.text.ExceptionConverter;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
-import com.lowagie.text.markup.MarkupTags;
+import com.lowagie.text.html.Markup;
import com.lowagie.text.pdf.BaseFont;
/**
@@ -38,16 +38,16 @@ import com.lowagie.text.pdf.BaseFont;
public class ITextFont
{
/** A normal font style */
- public static final String NORMAL = MarkupTags.CSS_VALUE_NORMAL;
+ public static final String NORMAL = Markup.CSS_VALUE_NORMAL;
/** A bold font style */
- public static final String BOLD = MarkupTags.CSS_VALUE_BOLD;
+ public static final String BOLD = Markup.CSS_VALUE_BOLD;
/** A italic font style */
- public static final String ITALIC = MarkupTags.CSS_VALUE_ITALIC;
+ public static final String ITALIC = Markup.CSS_VALUE_ITALIC;
/** An underline font style */
- public static final String UNDERLINE = MarkupTags.CSS_VALUE_UNDERLINE;
+ public static final String UNDERLINE = Markup.CSS_VALUE_UNDERLINE;
/** A default font name */
public static final String DEFAULT_FONT_NAME = FontFactory.HELVETICA;
@@ -262,7 +262,7 @@ public class ITextFont
{
Font font = getCurrentFont();
- return String.valueOf( font.color().getBlue() );
+ return String.valueOf( font.getColor().getBlue() );
}
/**
@@ -274,7 +274,7 @@ public class ITextFont
{
Font font = getCurrentFont();
- return String.valueOf( font.color().getGreen() );
+ return String.valueOf( font.getColor().getGreen() );
}
/**
@@ -286,7 +286,7 @@ public class ITextFont
{
Font font = getCurrentFont();
- return String.valueOf( font.color().getRed() );
+ return String.valueOf( font.getColor().getRed() );
}
/**
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 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
@@ -1232,9 +1232,9 @@ public class ITextSink
try
{
Image image = Image.getInstance( new URL( urlName ) );
- image.scaleToFit( ITextUtil.getDefaultPageSize().width() / 2, ITextUtil.getDefaultPageSize().height() / 2 );
- width = image.plainWidth();
- height = image.plainHeight();
+ image.scaleToFit( ITextUtil.getDefaultPageSize().getWidth() / 2, ITextUtil.getDefaultPageSize().getHeight() / 2 );
+ width = image.getPlainWidth();
+ height = image.getPlainHeight();
}
catch ( BadElementException e )
{
diff --git a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
index 4363413..141646c 100644
--- a/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
+++ b/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextUtil.java
@@ -22,9 +22,6 @@ package org.apache.maven.doxia.module.itext;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Rectangle;
-import com.lowagie.text.xml.XmlToHtml;
-import com.lowagie.text.xml.XmlToPdf;
-import com.lowagie.text.xml.XmlToRtf;
import java.io.InputStream;
import java.io.OutputStream;
@@ -77,7 +74,7 @@ public class ITextUtil
if ( currentField.getType().equals( Rectangle.class ) )
{
Rectangle fPageSize = (Rectangle) currentField.get( null );
- if ( ( rect.width() == fPageSize.width() ) && ( rect.height() == fPageSize.height() ) )
+ if ( ( rect.getWidth() == fPageSize.getWidth() ) && ( rect.getHeight() == fPageSize.getHeight() ) )
{
return currentField.getName();
}
@@ -114,68 +111,4 @@ public class ITextUtil
return false;
}
-
- /**
- * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing an Pdf document
- * specified <CODE>OutputStream</CODE>.
- *
- * @param is the <CODE>InputStream</CODE> from which the XML is read.
- * @param os the <CODE>OutputStream</CODE> to which the result as Pdf is written.
- * @see com.lowagie.text.xml.XmlToPdf
- */
- public static void writePdf( InputStream is, OutputStream os )
- {
- try
- {
- XmlToPdf x = new XmlToPdf();
-
- x.parse( is, os );
- }
- catch ( DocumentException e )
- {
- throw new RuntimeException( "DocumentException : " + e.getMessage(), e );
- }
- }
-
- /**
- * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing an rtf document
- * specified <CODE>OutputStream</CODE>.
- *
- * @param is the <CODE>InputStream</CODE> from which the XML is read.
- * @param os the <CODE>OutputStream</CODE> to which the result as RTF is written.
- * @see com.lowagie.text.xml.XmlToRtf
- */
- public static void writeRtf( InputStream is, OutputStream os )
- {
- try
- {
- XmlToRtf x = new XmlToRtf();
- x.parse( is, os );
- }
- catch ( DocumentException e )
- {
- throw new RuntimeException( "DocumentException : " + e.getMessage(), e );
- }
- }
-
- /**
- * Parse an iText XML from the specified <CODE>InputStream</CODE>, writing an html document
- * specified <CODE>OutputStream</CODE>.
- *
- * @param is the <CODE>InputStream</CODE> from which the XML is read.
- * @param os the <CODE>OutputStream</CODE> to which the result as Html is written.
- * @see com.lowagie.text.xml.XmlToHtml
- */
- public static void writeHtml( InputStream is, OutputStream os )
- {
- try
- {
- XmlToHtml x = new XmlToHtml();
- x.parse( is, os );
- }
- catch ( DocumentException e )
- {
- throw new RuntimeException( "DocumentException : " + e.getMessage(), e );
- }
- }
}
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 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
}
/**
- * Test PDF generation
- *
- * @throws Exception
- */
- public void testGeneratingPDFFromITextXml()
- throws Exception
- {
- File f = new File( getBasedir(), "src/test/resources/itext/itext.xml" );
-
- ITextUtil.writePdf( new FileInputStream( f ),
- new FileOutputStream( getGeneratedFile( "test_itext", "pdf" ) ) );
- }
-
- /**
* Generate a pdf and a rtf from the standart test model.
*
* @throws Exception if any
@@ -107,11 +93,6 @@ public class ITextSinkTestCase
SinkTestDocument.generate( sink );
sink.close();
-
- ITextUtil.writePdf( new FileInputStream( getGeneratedFile( "test_model", "xml" ) ),
- new FileOutputStream( getGeneratedFile( "test_model", "pdf" ) ) );
- ITextUtil.writeRtf( new FileInputStream( getGeneratedFile( "test_model", "xml" ) ),
- new FileOutputStream( getGeneratedFile( "test_model", "rtf" ) ) );
}
/**
@@ -148,8 +129,5 @@ public class ITextSinkTestCase
sink.flush();
sink.close();
-
- ITextUtil.writePdf( new FileInputStream( getGeneratedFile( "empty_anchor", "xml" ) ),
- new FileOutputStream( getGeneratedFile( "empty_anchor", "pdf" ) ) );
}
}
--
2.5.5

View File

@ -0,0 +1,72 @@
--- doxia-1.12.0/doxia-modules/doxia-module-fo/pom.xml.orig 2023-01-09 21:09:18.000000000 -0700
+++ doxia-1.12.0/doxia-modules/doxia-module-fo/pom.xml 2023-06-12 15:58:35.171254714 -0600
@@ -71,9 +71,9 @@ under the License.
<!-- misc -->
<dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>1.10</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-configuration2</artifactId>
+ <version>2.9.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
--- doxia-1.12.0/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java.orig 2023-01-09 21:09:18.000000000 -0700
+++ doxia-1.12.0/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoConfiguration.java 2023-06-12 17:00:19.630450286 -0600
@@ -20,14 +20,16 @@ package org.apache.maven.doxia.module.fo
*/
import java.io.File;
+import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.configuration2.XMLConfiguration;
+import org.apache.commons.configuration2.ex.ConfigurationException;
+import org.apache.commons.configuration2.io.FileLocatorUtils;
import org.apache.maven.doxia.sink.impl.SinkUtils;
import org.codehaus.plexus.util.ReaderFactory;
@@ -55,9 +57,6 @@ public class FoConfiguration
{
this.config = new XMLConfiguration();
- // necessary because some attributes contain commas:
- config.setDelimiterParsingDisabled( true );
-
loadDefaultConfig();
}
@@ -75,10 +74,11 @@ public class FoConfiguration
throws IOException
{
config.clear();
+ config.initFileLocator( FileLocatorUtils.fileLocator().basePath( configFile.getParent() ).fileName( configFile.getName() ).create() );
try
{
- config.load( configFile );
+ config.read( new FileReader(configFile) );
}
catch ( ConfigurationException cex )
{
@@ -182,9 +182,11 @@ public class FoConfiguration
/** Load the default fo configuration file. */
private void loadDefaultConfig()
{
+ config.initFileLocator( FileLocatorUtils.fileLocator().sourceURL( getClass().getResource( "/fo-styles.xslt" ) ).create() );
+
try
{
- config.load( ReaderFactory.newXmlReader( getClass().getResourceAsStream( "/fo-styles.xslt" ) ) );
+ config.read( ReaderFactory.newXmlReader( getClass().getResourceAsStream( "/fo-styles.xslt" ) ) );
}
catch ( ConfigurationException | IOException cex )
{

BIN
doxia-1.12.0-source-release.zip (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:180e5fd472389dc1d63bddebdfeff2824eda9d55fce5ee8d91f08f487dc9c7cf
size 1302131

BIN
maven-doxia-build.tar.xz (Stored with Git LFS)

Binary file not shown.

View File

@ -1,7 +1,7 @@
#
# spec file for package maven-doxia
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,7 @@
Name: maven-doxia
Version: 1.9.1
Version: 1.12.0
Release: 0
Summary: Content generation framework
License: Apache-2.0
@ -25,14 +25,13 @@ Group: Development/Libraries/Java
URL: https://maven.apache.org/doxia/
Source0: https://repo1.maven.org/maven2/org/apache/maven/doxia/doxia/%{version}/doxia-%{version}-source-release.zip
Source1: %{name}-build.tar.xz
# Build against iText 2.x
# https://issues.apache.org/jira/browse/DOXIA-53
Patch1: 0001-Fix-itext-dependency.patch
Patch0: 0002-Commons-configuration2.patch
BuildRequires: ant
BuildRequires: apache-commons-cli
BuildRequires: apache-commons-collections
BuildRequires: apache-commons-configuration
BuildRequires: apache-commons-configuration2
BuildRequires: apache-commons-lang3
BuildRequires: apache-commons-text
BuildRequires: fdupes
BuildRequires: guava
BuildRequires: httpcomponents-client
@ -184,7 +183,7 @@ API documentation for %{name}.
%prep
%setup -q -n doxia-%{version} -a1
%patch1 -p1
%patch0 -p1
# we don't have clirr-maven-plugin
%pom_remove_plugin org.codehaus.mojo:clirr-maven-plugin pom.xml
@ -192,11 +191,6 @@ API documentation for %{name}.
# 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" \
"<useJava5>true</useJava5>" doxia-modules/doxia-module-fml/pom.xml
# requires network
rm doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java
@ -211,9 +205,9 @@ rm doxia-core/src/test/java/org/apache/maven/doxia/util/XmlValidatorTest.java
mkdir -p lib
build-jar-repository -s lib \
apache-commons-lang3 \
apache-commons-lang \
apache-commons-text \
commons-cli \
commons-configuration \
commons-configuration2 \
guava/guava \
httpcomponents/httpclient \
httpcomponents/httpcore \