[izpack-devel] Custom Actions NPE, patch

Scott Plante splante at insightsys.com
Thu Mar 8 03:55:05 CET 2007


I discovered today that to create a custom listener you have to name the 
class the same as the listener. If you do not, you get a very unhelpful 
NullPointerException at the installer run time. I would like to propose 
that this patch be included in the next version. It will check, and 
cause an error at installer compile time if there is no matching class 
in the listener. This is an "svn diff", if there is a better way to 
submit patches, please let me know.


Index: lib/com/izforge/izpack/compiler/Compiler.java
===================================================================
--- lib/com/izforge/izpack/compiler/Compiler.java       (revision 1753)
+++ lib/com/izforge/izpack/compiler/Compiler.java       (working copy)
@@ -730,6 +730,12 @@
         URL url = findIzPackResource(jarPath, "CustomAction jar file");
         List filePaths = getContainedFilePaths(url);
         String fullClassName = getFullClassName(url, className);
+        if (fullClassName == null)
+        {
+          throw new CompilerException(
+              "CustomListener class '" + className + "' not found in '"
+              + url + "'. The class and listener name must match");
+        }
         CustomData ca = new CustomData(fullClassName, filePaths, 
constraints, type);
         packager.addCustomJar(ca, url);
     }


-- 
Scott Plante, CTO
Insight Systems, Inc.
(+1) 404 873 0058 x104
splante at insightsys.com
http://zyross.com




More information about the izpack-devel mailing list