From 456c83d1c957ae6986f981e2cdbbd26b47038ca5 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Fri, 7 Jun 2019 10:40:23 +0200 Subject: [PATCH] Port to JFlex 1.7.0 --- 0001-Port-to-JFlex-1.7.0.patch | 39 ++++++++++++++++++++++++++++++++++ qdox.spec | 8 +++---- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 0001-Port-to-JFlex-1.7.0.patch diff --git a/0001-Port-to-JFlex-1.7.0.patch b/0001-Port-to-JFlex-1.7.0.patch new file mode 100644 index 0000000..441858b --- /dev/null +++ b/0001-Port-to-JFlex-1.7.0.patch @@ -0,0 +1,39 @@ +From 31f530b26bd4625ffe41aa16c48836455ef81c23 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Fri, 7 Jun 2019 10:39:34 +0200 +Subject: [PATCH] Port to JFlex 1.7.0 + +--- + src/grammar/lexer.flex | 2 +- + .../java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/grammar/lexer.flex b/src/grammar/lexer.flex +index 9b567ff..cd9d5b6 100644 +--- a/src/grammar/lexer.flex ++++ b/src/grammar/lexer.flex +@@ -168,7 +168,7 @@ import java.util.*; + } + + public JFlexLexer( java.io.InputStream stream, java.io.Writer writer ) { +- this( stream ); ++ this( new java.io.InputStreamReader( stream, java.nio.charset.Charset.forName( "UTF-8" ) ) ); + this.writer = writer; + } + +diff --git a/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java b/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java +index c947f9b..5b415c0 100644 +--- a/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java ++++ b/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java +@@ -112,7 +112,7 @@ public class ClassLoaderLibrary + if ( sourceStream != null ) + { + Builder builder = getModelBuilder(); +- JavaLexer lexer = new JFlexLexer( sourceStream ); ++ JavaLexer lexer = new JFlexLexer( new java.io.InputStreamReader( sourceStream, java.nio.charset.Charset.forName( "UTF-8" ) ) ); + Parser parser = new Parser( lexer, builder ); + parser.setDebugLexer( debugLexer ); + parser.setDebugParser( debugParser ); +-- +2.21.0 + diff --git a/qdox.spec b/qdox.spec index ad0f4d4..7b35e0a 100644 --- a/qdox.spec +++ b/qdox.spec @@ -14,6 +14,7 @@ Source1: qdox-MANIFEST.MF # Remove bundled binaries which are possibly proprietary Source2: generate-tarball.sh +Patch0: 0001-Port-to-JFlex-1.7.0.patch BuildRequires: maven-local BuildRequires: mvn(org.apache.maven.plugins:maven-assembly-plugin) @@ -40,6 +41,7 @@ API docs for %{name}. %prep %setup -q -n %{name}-%{version}-%{vertag} +%patch0 -p1 find -name *.jar -delete rm -rf bootstrap @@ -54,10 +56,6 @@ rm -rf bootstrap %pom_xpath_set pom:workingDirectory '${basedir}/src/main/java/com/thoughtworks/qdox/parser/impl' -# Compatibility with JFlex 1.7.0 -sed -i 's/JFlexLexer(\(.*\))/JFlexLexer(new java.io.InputStreamReader((\1), java.nio.charset.Charset.forName("UTF-8")))/' \ - src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java - %build # Generate scanners (upstream does this with maven-jflex-plugin) jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/lexer.flex @@ -80,7 +78,7 @@ jar ufm target/%{name}-%{version}*.jar %{SOURCE1} %changelog * Fri Jun 07 2019 Mikolaj Izdebski - 2.0-5.M9 -- Don't use deprecated inputstreamctor option +- Port to JFlex 1.7.0 * Fri May 24 2019 Mikolaj Izdebski - 2.0-4.M9 - Mass rebuild for javapackages-tools 201901