This commit is contained in:
parent
7a04d08d98
commit
cb07c82c87
92
0004-Remove-dependency-on-jtidy.patch
Normal file
92
0004-Remove-dependency-on-jtidy.patch
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
From 6953b37ee5a7c0566d2e11e7141768f8a4c03fa2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
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 <code>null</code>.
|
||||||
|
- * @return The description with valid XHTML tags, never <code>null</code>.
|
||||||
|
- */
|
||||||
|
- 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( "<body>" + ls ) + 6 + ls.length();
|
||||||
|
- int endPos = commentCleaned.indexOf( ls + "</body>" );
|
||||||
|
- 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
|
||||||
|
|
@ -30,7 +30,7 @@ Source1: %{base_name}-build.tar.xz
|
|||||||
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
||||||
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
||||||
Patch2: 0003-Port-to-plexus-utils-3.0.24.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
|
# The maven-plugin-plugin is used to generate those descriptors, which
|
||||||
# creates a circular dependency of maven-plugin-plugin on itself.
|
# creates a circular dependency of maven-plugin-plugin on itself.
|
||||||
# We generated those ones outside the rpm build for a bootstrap package.
|
# We generated those ones outside the rpm build for a bootstrap package.
|
||||||
|
@ -28,7 +28,7 @@ Source0: http://repo2.maven.org/maven2/org/apache/maven/plugin-tools/%{ba
|
|||||||
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
||||||
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
||||||
Patch2: 0003-Port-to-plexus-utils-3.0.24.patch
|
Patch2: 0003-Port-to-plexus-utils-3.0.24.patch
|
||||||
Patch3: stringutils.patch
|
Patch3: 0004-Remove-dependency-on-jtidy.patch
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: maven-local
|
BuildRequires: maven-local
|
||||||
BuildRequires: unzip
|
BuildRequires: unzip
|
||||||
|
@ -28,7 +28,7 @@ Source1: %{name}-build.tar.xz
|
|||||||
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
Patch0: 0001-Avoid-duplicate-MOJO-parameters.patch
|
||||||
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
Patch1: 0002-Deal-with-nulls-from-getComment.patch
|
||||||
Patch2: 0003-Port-to-plexus-utils-3.0.24.patch
|
Patch2: 0003-Port-to-plexus-utils-3.0.24.patch
|
||||||
Patch3: stringutils.patch
|
Patch3: 0004-Remove-dependency-on-jtidy.patch
|
||||||
BuildRequires: ant
|
BuildRequires: ant
|
||||||
BuildRequires: apache-commons-cli
|
BuildRequires: apache-commons-cli
|
||||||
BuildRequires: atinject
|
BuildRequires: atinject
|
||||||
@ -39,7 +39,6 @@ BuildRequires: guava
|
|||||||
BuildRequires: java-devel >= 1.8
|
BuildRequires: java-devel >= 1.8
|
||||||
BuildRequires: javapackages-local
|
BuildRequires: javapackages-local
|
||||||
BuildRequires: jdom2
|
BuildRequires: jdom2
|
||||||
BuildRequires: jtidy
|
|
||||||
BuildRequires: junit
|
BuildRequires: junit
|
||||||
BuildRequires: maven-lib
|
BuildRequires: maven-lib
|
||||||
BuildRequires: maven-reporting-api
|
BuildRequires: maven-reporting-api
|
||||||
@ -186,7 +185,6 @@ build-jar-repository -s lib \
|
|||||||
guava/guava \
|
guava/guava \
|
||||||
guice/google-guice-no_aop \
|
guice/google-guice-no_aop \
|
||||||
jdom2/jdom2 \
|
jdom2/jdom2 \
|
||||||
jtidy \
|
|
||||||
junit \
|
junit \
|
||||||
maven/maven-artifact \
|
maven/maven-artifact \
|
||||||
maven/maven-compat \
|
maven/maven-compat \
|
||||||
|
@ -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 "";
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user