[antlr-maven-plugin/f18] fix NPE during grammar processing, thanks to Michal Srb
Tom Callaway
spot at fedoraproject.org
Fri Oct 18 22:56:49 UTC 2013
commit d7780c9c32c886d3c20ba8bfda18b2836e07ba66
Author: Tom Callaway <spot at fedoraproject.org>
Date: Fri Oct 18 23:56:48 2013 +0100
fix NPE during grammar processing, thanks to Michal Srb
0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch | 72 ++++++++++++++++++
antlr-maven-plugin.spec | 78 +++++++++----------
2 files changed, 109 insertions(+), 41 deletions(-)
---
diff --git a/0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch b/0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch
new file mode 100644
index 0000000..7ac7141
--- /dev/null
+++ b/0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch
@@ -0,0 +1,72 @@
+From 1305d8d7aa5f9724e28d54a112a524f9a2fb0af7 Mon Sep 17 00:00:00 2001
+From: Michal Srb <msrb at redhat.com>
+Date: Wed, 16 Oct 2013 14:29:21 +0200
+Subject: [PATCH] [MANTLR-34] Fix NPE when building Jenkins
+
+---
+ .../mojo/antlr/metadata/MetadataExtracter.java | 40 ++++++++++++----------
+ 1 file changed, 21 insertions(+), 19 deletions(-)
+
+diff --git a/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java b/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
+index c54f301..8637dea 100644
+--- a/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
++++ b/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
+@@ -239,34 +239,36 @@ public class MetadataExtracter
+ Method getRHSMethod = helper.getAntlrOptionClass().getMethod( "getRHS", Helper.NO_ARG_SIGNATURE );
+ getRHSMethod.setAccessible( true );
+
+- Object importVocabOption = getElementMethod.invoke( options, new Object[] { "importVocab" } );
+- if ( importVocabOption != null )
+- {
+- String importVocab = (String) getRHSMethod.invoke( importVocabOption, Helper.NO_ARGS );
+- if ( importVocab != null )
++ if ( options != null ) {
++ Object importVocabOption = getElementMethod.invoke( options, new Object[] { "importVocab" } );
++ if ( importVocabOption != null )
+ {
+- importVocab = importVocab.trim();
+- if ( importVocab.endsWith( ";" ) )
++ String importVocab = (String) getRHSMethod.invoke( importVocabOption, Helper.NO_ARGS );
++ if ( importVocab != null )
+ {
+- importVocab = importVocab.substring( 0, importVocab.length() - 1 );
++ importVocab = importVocab.trim();
++ if ( importVocab.endsWith( ";" ) )
++ {
++ importVocab = importVocab.substring( 0, importVocab.length() - 1 );
++ }
++ grammar.setImportVocab( importVocab );
+ }
+- grammar.setImportVocab( importVocab );
+ }
+- }
+
+- Object exportVocabOption = getElementMethod.invoke( options, new Object[] { "exportVocab" } );
+- if ( exportVocabOption != null )
+- {
+- String exportVocab = (String) getRHSMethod.invoke( exportVocabOption, Helper.NO_ARGS );
+- if ( exportVocab != null )
++ Object exportVocabOption = getElementMethod.invoke( options, new Object[] { "exportVocab" } );
++ if ( exportVocabOption != null )
+ {
+- exportVocab = exportVocab.trim();
+- if ( exportVocab.endsWith( ";" ) )
++ String exportVocab = (String) getRHSMethod.invoke( exportVocabOption, Helper.NO_ARGS );
++ if ( exportVocab != null )
+ {
+- exportVocab = exportVocab.substring( 0, exportVocab.length() - 1 );
++ exportVocab = exportVocab.trim();
++ if ( exportVocab.endsWith( ";" ) )
++ {
++ exportVocab = exportVocab.substring( 0, exportVocab.length() - 1 );
++ }
+ }
++ grammar.setExportVocab( exportVocab );
+ }
+- grammar.setExportVocab( exportVocab );
+ }
+ }
+ catch ( Throwable t )
+--
+1.8.3.1
+
diff --git a/antlr-maven-plugin.spec b/antlr-maven-plugin.spec
index 6432dd0..83a0d92 100644
--- a/antlr-maven-plugin.spec
+++ b/antlr-maven-plugin.spec
@@ -1,6 +1,6 @@
Name: antlr-maven-plugin
Version: 2.2
-Release: 6%{?dist}
+Release: 12%{?dist}
Summary: Maven plugin that generates files based on grammar file(s)
License: ASL 2.0
URL: http://mojo.codehaus.org/antlr-maven-plugin/
@@ -12,39 +12,20 @@ Source0: http://repo1.maven.org/maven2/org/codehaus/mojo/%{name}/%{version}/%{n
Patch0: maven-antlr-plugin-2.2-modello-issue.patch
# siteRenderer.createSink doesn't exist anymore
Patch2: maven-antlr-plugin-2.1-sinkfix.patch
+# Fix grammar processing bug (bz 1020312)
+Patch3: 0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch
BuildArch: noarch
BuildRequires: java-devel
BuildRequires: jpackage-utils
BuildRequires: antlr
-BuildRequires: maven
-BuildRequires: maven-enforcer-plugin
-BuildRequires: maven-compiler-plugin
-BuildRequires: maven-install-plugin
-BuildRequires: maven-jar-plugin
-BuildRequires: maven-javadoc-plugin
-BuildRequires: maven-resources-plugin
-BuildRequires: maven-surefire-plugin
-BuildRequires: maven-antrun-plugin
-BuildRequires: maven-clean-plugin
-BuildRequires: maven-invoker-plugin
-BuildRequires: maven-plugin-plugin
-BuildRequires: maven-release-plugin
-BuildRequires: maven-site-plugin
-BuildRequires: maven-source-plugin
+BuildRequires: maven-local
BuildRequires: maven-plugin-bundle
BuildRequires: maven-plugin-cobertura
BuildRequires: apache-commons-exec
-BuildRequires: maven2-common-poms
BuildRequires: modello
-Requires: antlr
-Requires: maven
-Requires: jpackage-utils
-Requires: apache-commons-exec
-Requires: java >= 1:1.6.0
-
Provides: maven2-plugin-antlr = %{version}-%{release}
Obsoletes: maven2-plugin-antlr <= 2.0.8
@@ -57,7 +38,6 @@ The Antlr Plugin has two goals:
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation
-Requires: jpackage-utils
%description javadoc
This package contains the API documentation for %{name}.
@@ -66,37 +46,53 @@ This package contains the API documentation for %{name}.
%setup -q
%patch0 -p1 -b .modello
%patch2 -p1 -b .sink
+%patch3 -p1 -b .fixnpe
+
+# reporting eventually pulls in another antlr and we'd break with weird errors
+%pom_xpath_inject "pom:dependency[pom:artifactId[text()='maven-reporting-impl']]/pom:exclusions" "
+ <exclusion>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ </exclusion>"
# remove all binary bits
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;
+%mvn_file : %{name}
+
%build
-mvn-rpmbuild -Dmaven.test.skip=true \
-install javadoc:aggregate
+%mvn_build -- -Dmaven.test.skip=true
%install
-mkdir -p %{buildroot}%{_javadir}
+%mvn_install
-cp -p target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
+%files -f .mfiles
-mkdir -p %{buildroot}%{_javadocdir}/%{name}
-cp -rp target/site/apidocs/ %{buildroot}%{_javadocdir}/%{name}
+%files javadoc -f .mfiles-javadoc
-install -d -m 755 %{buildroot}%{_mavenpomdir}
-install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
+%changelog
+* Fri Oct 18 2013 Tom Callaway <spot at fedoraproject.org> - 2.2-12
+- Fix grammar processing bug (bz 1020312)
+ Thanks to Michal Srb
-%add_maven_depmap JPP-%{name}.pom %{name}.jar
+* Sat Aug 24 2013 Mat Booth <fedora at matbooth.co.uk> - 2.2-11
+- Remove unneeded BR on maven2-common-poms
+- Update for newer guidelines
-%files
-%{_mavenpomdir}/JPP-%{name}.pom
-%{_mavendepmapfragdir}/%{name}
-%{_javadir}/%{name}.jar
+* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2-10
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
-%files javadoc
-%{_javadocdir}/%{name}
+* Mon Mar 04 2013 Stanislav Ochotnicky <sochotnicky at redhat.com> - 2.2-9
+- Add dependency exclusion for antlr (#911054)
+
+* Wed Feb 13 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2-8
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
+
+* Wed Feb 06 2013 Java SIG <java-devel at lists.fedoraproject.org> - 2.2-7
+- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild
+- Replace maven BuildRequires with maven-local
-%changelog
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
@@ -115,7 +111,7 @@ install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
- Use upstream sources.
- Adapt to current guidelines.
-* Mon Mar 3 2011 Tom Callaway <spot at fedoraproject.org> 2.2-1.20110307svn13719
+* Thu Mar 3 2011 Tom Callaway <spot at fedoraproject.org> 2.2-1.20110307svn13719
- update to 2.2 tag
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.1-4.20101012svn12849
More information about the scm-commits
mailing list