Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 254055

Summary: dev-java/relaxngcc-1.12: missing resources in relaxngcc.jar
Product: Gentoo Linux Reporter: Martin von Gagern <Martin.vGagern>
Component: [OLD] JavaAssignee: Java team <java>
Status: RESOLVED FIXED    
Severity: normal Keywords: InOverlay
Priority: High    
Version: 2008.0   
Hardware: All   
OS: Linux   
Whiteboard: java-experimental
Package list:
Runtime testing required: ---
Attachments: Differences from 1.12 to 1.12-r1 ebuild and build.xml

Description Martin von Gagern 2009-01-07 11:07:24 UTC
The relaxngcc.jar created by the relaxngcc-1.12.ebuild is missing some resources. Namely NGCCGrammar tries to copy the following files using copyResourceAsStream:
* NGCCHandler.java
* AttributesImpl.java
* NGCCRuntime.java
* NGCCEventReceiver.java
* NGCCEventSource.java
* NGCCInterleaveFilter.java

Without these resources in place, getResourceAsStream will return null, leading to a null pointer exception with the following backtrace:

Exception in thread "main" java.lang.NullPointerException
	at java.io.Reader.<init>(Reader.java:61)
	at java.io.InputStreamReader.<init>(InputStreamReader.java:55)
	at relaxngcc.NGCCGrammar.copyResourceAsFile(Unknown Source)
	at relaxngcc.NGCCGrammar.output(Unknown Source)
	at relaxngcc.RelaxNGCC.run(Unknown Source)
	at relaxngcc.RelaxNGCC.main(Unknown Source)

I experienced this when trying to compile jaxb 2.1.9 in order to work on bug 188007. The xjc submodule invokes the equivalent of "java --target somedir src/com/sun/tools/jxc/gen/config/config.rng" from its ngcc ant target.

I will attach diffs of build files for a 1.12-r1 revbump, as the problem is a run-time and not a compile-time one. I made a few more modifications than strictly necessary, to improve the readability of the ebuild I think. If you want me to, I could commit these improvements to java-experimental.
Comment 1 Martin von Gagern 2009-01-07 11:16:28 UTC
Created attachment 177661 [details, diff]
Differences from 1.12 to 1.12-r1 ebuild and build.xml

This diff compares the original 1.12 ebuild and build.xml to my new 1.12-r1 versions.

Changes to the ebuild:
1. Don't throw away *.jar. Especially keep relaxngcc.jar, renamed to
   relaxngcc.orig.jar, so that ant can extract project.xml from there.
2. Don't use manifest from filesdir, but define manifest in build.xml
3. Use the new build.xml

Changes to the build.xml:
4. Don't disable debug information, as that helps stack traces,
   and disabling it results only in minor space savings.
5. Include resources the same way project.xml defines them.
Comment 2 Martin von Gagern 2009-01-21 08:54:17 UTC
Comitted to java-experimental:
http://overlays.gentoo.org/proj/java/browser/java-experimental/dev-java/relaxngcc?rev=7330
Comment 3 Petteri Räty (RETIRED) gentoo-dev 2009-04-05 22:37:01 UTC
+*relaxngcc-1.12-r1 (05 Apr 2009)
+
+  05 Apr 2009; Petteri Räty <betelgeuse@gentoo.org>
+  +files/build.xml-1.12-r1, +relaxngcc-1.12-r1.ebuild:
+  Include resources in the build jar, migrate to EAPI 2 and add examples use
+  flag. Fixes bug #254055. Thanks to Martin von Gagern
+  <Martin.vGagern@gmx.net> for fixing the resources problem.
+