Bug 37417 - Patch to support fop from partially implemented Class Loaders.
Summary: Patch to support fop from partially implemented Class Loaders.
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: trunk
Hardware: All other
: P5 enhancement
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-09 01:09 UTC by Timothy Gates
Modified: 2012-04-01 06:28 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Gates 2005-11-09 01:09:22 UTC
org.apach.fop.Version line 33 (ver 328820) assumes that 
Version.class.getPackage() will return the package info of the class however 
it may return null if it was loaded from an incomplete class loader that 
doesn't implement definePackage correctly by loading the manifest info from 
the jar file. Whilst the proper solution is to fix these class loaders it 
would be prudent to gracefully handle this situation.

The attached patch attempts to do so.

==START PATCH==

Index: src/java/org/apache/fop/Version.java
===================================================================
--- src/java/org/apache/fop/Version.java        (revision 331635)
+++ src/java/org/apache/fop/Version.java        (working copy)
@@ -30,7 +30,11 @@
      * @return the version string
      */
     public static String getVersion() {
-        String version = Version.class.getPackage().getImplementationVersion
();
+        String version = null;
+        Package jarinfo = Version.class.getPackage();
+        if(jarinfo != null) {
+            version = jarinfo.getImplementationVersion();
+        }
         if (version == null) {
             //Fallback if FOP is used in a development environment
             String headURL 


==END PATCH==
Comment 1 Jeremias Maerki 2005-11-09 09:12:43 UTC
Patch applied: http://svn.apache.org/viewcvs?rev=331991&view=rev

Thanks for catching that. One request, though: Please attach patches as a file
to Bugzilla issues. Bugzilla tends to add additional line breaks to the patch if
included in comments. It was no problem in this case (just one additional line
break), but with bigger patches this will become a problem.
Comment 2 Glenn Adams 2012-04-01 06:28:37 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed