From 99da812bd15b338bc3d343aed4209a7b0b444dc2 Mon Sep 17 00:00:00 2001 From: Kaloyan Enimanev Date: Sun, 17 Jul 2011 23:29:20 +0200 Subject: [PATCH 2/3] bugfix: do not use the System classloader when loading IzPack classes. That does not work well when running within ANT environment on Mac OS. The issue has been reported here http://http://groups.google.com/group/izpack-user/browse_thread/thread/248fb54814bbb0c4/a87bce14c191efa8 --- .../izpack/merge/resolve/ClassPathCrawler.java | 24 ++++++++++++------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/izpack-core/src/main/java/com/izforge/izpack/merge/resolve/ClassPathCrawler.java b/izpack-core/src/main/java/com/izforge/izpack/merge/resolve/ClassPathCrawler.java index e8cad67..76b404b 100644 --- a/izpack-core/src/main/java/com/izforge/izpack/merge/resolve/ClassPathCrawler.java +++ b/izpack-core/src/main/java/com/izforge/izpack/merge/resolve/ClassPathCrawler.java @@ -1,18 +1,24 @@ package com.izforge.izpack.merge.resolve; -import com.izforge.izpack.api.exception.IzPackException; -import com.izforge.izpack.api.exception.MergeException; -import com.izforge.izpack.api.merge.Mergeable; -import com.izforge.izpack.merge.ClassResolver; -import com.izforge.izpack.util.FileUtil; - import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.JarURLConnection; import java.net.URL; import java.net.URLClassLoader; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.izforge.izpack.api.exception.IzPackException; +import com.izforge.izpack.api.exception.MergeException; +import com.izforge.izpack.api.merge.Mergeable; +import com.izforge.izpack.merge.ClassResolver; +import com.izforge.izpack.util.FileUtil; /** * Crawl and store a map of all files in classpath when we can't get package directly @@ -101,7 +107,7 @@ public class ClassPathCrawler { try { - return Class.forName(className); + return getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { @@ -117,7 +123,7 @@ public class ClassPathCrawler if (urlList != null) { String fullClassName = ClassResolver.processURLToClassName(urlList.iterator().next()); - return Class.forName(fullClassName); + return getClass().getClassLoader().loadClass(fullClassName); } } catch (ClassNotFoundException ignored) -- 1.7.4.1