[izpack-devel] Null pointer exception when using custom action

Dennis Reil Dennis.Reil at reddot.de
Mon Sep 4 15:39:14 CEST 2006


I just discovered a null pointer exception in Unpacker. I created a
custom action which tries to detect in beforePacks()-method if all
selected packs have to be installed. If there's an already installed
pack, the custom action removes it from the list. This causes a null
pointer in the for-loop in Unpacker.run() cause the variables packs and
npack are initialized just before calling informListener()-method and
are never updated before using them after informListener().

To fix the problem, the following lines 

packs = idata.selectedPacks;
npacks = packs.size();

have to be added after:
List packs = idata.selectedPacks;
int npacks = packs.size();
handler.startAction("Unpacking", npacks);
udata = UninstallData.getInstance();
// Custom action listener stuff --- load listeners ----
List[] customActions = getCustomActions();
// Custom action listener stuff --- beforePacks ----
informListeners(customActions, InstallerListener.BEFORE_PACKS, idata,
new Integer(npacks), handler);

Attached, you'll find a patch file which does this.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: Unpacker.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/izpack-devel/attachments/20060904/7d826fd8/attachment.bin 

More information about the izpack-devel mailing list