[izpack-devel] Bug in InstallerFrame.java, v3.9.0

François Guillet francois.guillet at wanadoo.fr
Mon Nov 6 07:30:28 CET 2006


Hi all,

I was asked by Julien to report this bug to the izpack-devel mailing
list.
While making an installer for both Windows and Linux using IzPack, I had
to resort to OS Specific panels. But having a windows only panel when
installing under Linux raised an exception (and vice versa). The point
is that OS dependant panels are incorrectly ignored in
InstallerFrame.loadPanels(). The error is pretty easy to reproduce so I
won't reprint the full error exception trace. I badly need those OS
dependant panels (that's one of the major points of a cross-platform
installer), so I made a quick fix in the source code. Here is the
modified source code for InstallerFrame.loadPanels(). It's a
straightforward quick hack which may be a bit crude, but it allows me to
finish the installer for the Art of Illusion project
(http://www.artofillusion.org).

The full InstallerFrame.java code is attached.

François.


    private void loadPanels() throws Exception
    {
        // Initialisation
        java.util.List panelsOrder = installdata.panelsOrder;
        int i;
        int size = panelsOrder.size();
        String className;
        Class objectClass;
        Constructor constructor;
        Object object;
        IzPanel panel;
        Class[] paramsClasses = new Class[2];
        paramsClasses[0] =
Class.forName("com.izforge.izpack.installer.InstallerFrame");
        paramsClasses[1] =
Class.forName("com.izforge.izpack.installer.InstallData");
        Object[] params = { this, installdata};

        // We load each of them
        int curVisPanelNumber = 0;
        int lastVis = 0;
        int count = 0;
        for (i = 0; i < size; i++)
        {
            // We add the panel
            Panel p = (Panel) panelsOrder.get(i);
            if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints))
                    continue;
            className = p.className;
            String praefix = "com.izforge.izpack.panels.";
            if (className.indexOf('.') > -1)
            // Full qualified class name
                praefix = "";
            objectClass = Class.forName(praefix + className);
            constructor =
objectClass.getDeclaredConstructor(paramsClasses);
            object = constructor.newInstance(params);
            panel = (IzPanel) object;
            installdata.panels.add(panel);
            if (panel.isHidden())
                visiblePanelMapping.add(i, new Integer(-1));
            else
            {
                visiblePanelMapping.add(count, new
Integer(curVisPanelNumber));
                curVisPanelNumber++;
                lastVis = count;
            }
            count++;
            // We add the XML data panel root
            XMLElement panelRoot = new XMLElement(className);
            installdata.xmlData.addChild(panelRoot);
        }
        visiblePanelMapping.add(count,new Integer(lastVis));
    }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InstallerFrame.java
Type: text/x-csrc
Size: 53833 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/izpack-devel/attachments/20061106/68782fdb/attachment.bin 


More information about the izpack-devel mailing list