From cb07c82c87ddfb49c17b78c13b087526f51693ffc509443a8b5d2995cf5844f3 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 24 Jul 2023 20:37:07 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/maven-plugin-tools?expand=0&rev=33 --- 0004-Remove-dependency-on-jtidy.patch | 92 +++++++++++++++++++++++++++ maven-plugin-plugin-bootstrap.spec | 2 +- maven-plugin-plugin.spec | 2 +- maven-plugin-tools.spec | 4 +- stringutils.patch | 11 ---- 5 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 0004-Remove-dependency-on-jtidy.patch delete mode 100644 stringutils.patch diff --git a/0004-Remove-dependency-on-jtidy.patch b/0004-Remove-dependency-on-jtidy.patch new file mode 100644 index 0000000..437062d --- /dev/null +++ b/0004-Remove-dependency-on-jtidy.patch @@ -0,0 +1,92 @@ +From 6953b37ee5a7c0566d2e11e7141768f8a4c03fa2 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Mon, 27 Apr 2020 12:56:04 +0200 +Subject: [PATCH 2/3] Remove dependency on jtidy + +--- + .../plugin/generator/GeneratorUtils.java | 55 +------------------ + 1 file changed, 1 insertion(+), 54 deletions(-) + +diff --git a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java +index e9ec47fe..1393b507 100644 +--- a/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java ++++ b/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java +@@ -52,7 +52,6 @@ import org.apache.maven.reporting.MavenReport; + import org.codehaus.plexus.component.repository.ComponentDependency; + import org.codehaus.plexus.util.StringUtils; + import org.codehaus.plexus.util.xml.XMLWriter; +-import org.w3c.tidy.Tidy; + + import static java.nio.charset.StandardCharsets.UTF_8; + +@@ -262,58 +261,6 @@ public final class GeneratorUtils + return decoded.toString(); + } + +- /** +- * Fixes some javadoc comment to become a valid XHTML snippet. +- * +- * @param description Javadoc description with HTML tags, may be null. +- * @return The description with valid XHTML tags, never null. +- */ +- public static String makeHtmlValid( String description ) +- { +- if ( StringUtils.isEmpty( description ) ) +- { +- return ""; +- } +- +- String commentCleaned = decodeJavadocTags( description ); +- +- // Using jTidy to clean comment +- Tidy tidy = new Tidy(); +- tidy.setDocType( "loose" ); +- tidy.setXHTML( true ); +- tidy.setXmlOut( true ); +- tidy.setInputEncoding( "UTF-8" ); +- tidy.setOutputEncoding( "UTF-8" ); +- tidy.setMakeClean( true ); +- tidy.setNumEntities( true ); +- tidy.setQuoteNbsp( false ); +- tidy.setQuiet( true ); +- tidy.setShowWarnings( false ); +- try +- { +- ByteArrayOutputStream out = new ByteArrayOutputStream( commentCleaned.length() + 256 ); +- tidy.parse( new ByteArrayInputStream( commentCleaned.getBytes( UTF_8 ) ), out ); +- commentCleaned = out.toString( "UTF-8" ); +- } +- catch ( UnsupportedEncodingException e ) +- { +- // cannot happen as every JVM must support UTF-8, see also class javadoc for java.nio.charset.Charset +- } +- +- if ( StringUtils.isEmpty( commentCleaned ) ) +- { +- return ""; +- } +- +- // strip the header/body stuff +- String ls = System.getProperty( "line.separator" ); +- int startPos = commentCleaned.indexOf( "" + ls ) + 6 + ls.length(); +- int endPos = commentCleaned.indexOf( ls + "" ); +- commentCleaned = commentCleaned.substring( startPos, endPos ); +- +- return commentCleaned; +- } +- + /** + * Converts a HTML fragment as extracted from a javadoc comment to a plain text string. This method tries to retain + * as much of the text formatting as possible by means of the following transformations: +@@ -345,7 +292,7 @@ public final class GeneratorUtils + + try + { +- parser.parse( new StringReader( makeHtmlValid( html ) ), htmlCallback, true ); ++ parser.parse( new StringReader( html ), htmlCallback, true ); + } + catch ( IOException e ) + { +-- +2.35.1 + diff --git a/maven-plugin-plugin-bootstrap.spec b/maven-plugin-plugin-bootstrap.spec index 1f9fe38..1894904 100644 --- a/maven-plugin-plugin-bootstrap.spec +++ b/maven-plugin-plugin-bootstrap.spec @@ -30,7 +30,7 @@ Source1: %{base_name}-build.tar.xz Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch Patch1: 0002-Deal-with-nulls-from-getComment.patch Patch2: 0003-Port-to-plexus-utils-3.0.24.patch -Patch3: stringutils.patch +Patch3: 0004-Remove-dependency-on-jtidy.patch # The maven-plugin-plugin is used to generate those descriptors, which # creates a circular dependency of maven-plugin-plugin on itself. # We generated those ones outside the rpm build for a bootstrap package. diff --git a/maven-plugin-plugin.spec b/maven-plugin-plugin.spec index c75488e..443667b 100644 --- a/maven-plugin-plugin.spec +++ b/maven-plugin-plugin.spec @@ -28,7 +28,7 @@ Source0: http://repo2.maven.org/maven2/org/apache/maven/plugin-tools/%{ba Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch Patch1: 0002-Deal-with-nulls-from-getComment.patch Patch2: 0003-Port-to-plexus-utils-3.0.24.patch -Patch3: stringutils.patch +Patch3: 0004-Remove-dependency-on-jtidy.patch BuildRequires: fdupes BuildRequires: maven-local BuildRequires: unzip diff --git a/maven-plugin-tools.spec b/maven-plugin-tools.spec index 461a514..782c4a6 100644 --- a/maven-plugin-tools.spec +++ b/maven-plugin-tools.spec @@ -28,7 +28,7 @@ Source1: %{name}-build.tar.xz Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch Patch1: 0002-Deal-with-nulls-from-getComment.patch Patch2: 0003-Port-to-plexus-utils-3.0.24.patch -Patch3: stringutils.patch +Patch3: 0004-Remove-dependency-on-jtidy.patch BuildRequires: ant BuildRequires: apache-commons-cli BuildRequires: atinject @@ -39,7 +39,6 @@ BuildRequires: guava BuildRequires: java-devel >= 1.8 BuildRequires: javapackages-local BuildRequires: jdom2 -BuildRequires: jtidy BuildRequires: junit BuildRequires: maven-lib BuildRequires: maven-reporting-api @@ -186,7 +185,6 @@ build-jar-repository -s lib \ guava/guava \ guice/google-guice-no_aop \ jdom2/jdom2 \ - jtidy \ junit \ maven/maven-artifact \ maven/maven-compat \ diff --git a/stringutils.patch b/stringutils.patch deleted file mode 100644 index 4df99cb..0000000 --- a/stringutils.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- maven-plugin-tools-3.6.0/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java 2018-10-29 10:41:50.000000000 +0100 -+++ maven-plugin-tools-3.6.0/maven-plugin-tools-generators/src/main/java/org/apache/maven/tools/plugin/generator/GeneratorUtils.java 2023-07-24 22:15:51.121414876 +0200 -@@ -292,7 +292,7 @@ - // cannot happen as every JVM must support UTF-8, see also class javadoc for java.nio.charset.Charset - } - -- if ( StringUtils.isEmpty( commentCleaned ) ) -+ if (commentCleaned == null || commentCleaned.isEmpty()) - { - return ""; - }