I was trying to fit a prewritten module that I had in Phoenix [make a block
out of it]. This particular module has a lot of dependencies of other
thirdparty jars (like jdbc stuff etc.). While playing with it I realized
that if a third party jar is deployed in the sar file for the block which
does not have a manifest in it Phoenix gives a null pointer exception and
exits.
A little analysis showed that the getListed function in the Extension.java
of the Extension package of Excalibur did not check for a null in the
manifest entry passed to it and was throwing a null pointer if so. Just a
check for null fixed it.

Here is the code I modified -

    /**
     * Retrieve all the extensions listed under a particular key
     * (Usually EXTENSION_LIST or OPTIONAL_EXTENSION_LIST).
     *
     * @param manifest the manifest to extract extensions from
     * @param listKey the key used to get list (Usually
     *        EXTENSION_LIST or OPTIONAL_EXTENSION_LIST)
     * @return the list of listed extensions
     */
    private static Extension[] getListed( final Manifest manifest,
                                          final Attributes.Name listKey )
    {
        final ArrayList results = new ArrayList();
>>        if( null != manifest)
>>        {
            final Attributes mainAttributes = manifest.getMainAttributes();

            if( null != mainAttributes )
            {
                getExtension( mainAttributes, results, listKey );
            }

            final Map entries = manifest.getEntries();
            final Iterator keys = entries.keySet().iterator();
            while( keys.hasNext() )
            {
                final String key = (String)keys.next();
                final Attributes attributes = (Attributes)entries.get( key
);
                getExtension( attributes, results, listKey );
            }
>>        }
        return (Extension[])results.toArray( new Extension[ 0 ] );
    }

Atul.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to