From 74e49271dc22cfa0c1275fb988a3ab232fb359f6 Mon Sep 17 00:00:00 2001 From: Glen Mazza Date: Tue, 7 Oct 2003 20:38:33 +0000 Subject: [PATCH] Porting from trunk back to maintenance a check for a null class loader while loading ElementMappings; code originally done by Keiron http://cvs.apache.org/viewcvs.cgi/xml-fop/src/org/apache/fop/apps/Attic/Driver.java.diff?r1=1.37&r2=1.38&diff_format=h git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@196950 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/apps/Driver.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index 61e466c49..965010eb0 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -581,14 +581,20 @@ class Service { public static synchronized Enumeration providers(Class cls) { ClassLoader cl = cls.getClassLoader(); + // null if loaded by bootstrap class loader + if(cl == null) { + cl = ClassLoader.getSystemClassLoader(); + } + String serviceFile = "META-INF/services/" + cls.getName(); // System.out.println("File: " + serviceFile); Vector v = (Vector)providerMap.get(serviceFile); - if (v != null) + if (v != null) { return v.elements(); - + } + v = new Vector(); providerMap.put(serviceFile, v); -- 2.39.5