cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Lagunov <ivan.lagu...@nxp.com>
Subject NPE during source validity check for ValidatingTransformer
Date Tue, 28 Feb 2012 14:57:16 GMT
Hi,

I've caught the following NullPointerException:

org.apache.excalibur.source.impl.validity.AggregatedValidity.isValid(AggregatedValidity.java:45)
org.apache.cocoon.components.validation.impl.CachingValidator.getSchema(CachingValidator.java:129)
org.apache.cocoon.components.validation.impl.AbstractValidator.getValidationHandler(AbstractValidator.java:330)
org.apache.cocoon.components.validation.impl.AbstractValidator.getValidationHandler(AbstractValidator.java:244)
org.apache.cocoon.transformation.ValidatingTransformer.setup(ValidatingTransformer.java:135)

So what is happening? It appeared that AggregatedValidity.m_list array list held null element.
The null element was added to m_list in ValidationResolver. resolveSource method:
        /* Record the current source in the validities to return */
        this.sourceValidity.add(source.getValidity());

The javadoc for Source.getValidity() says:
Get the Validity object. This can either wrap the last modification date or some expiry information
or anything else describing this object's validity.
If it is currently not possible to calculate such an information, null is returned.

The fact is that my Source is being loaded from XML DB by custom generator and it seems to
be correct that validity is null. I suppose it's a bug and it can be fixed in the following
way:
        /* Record the current source in the validities to return */
        If (source.getValidity() != null) this.sourceValidity.add(source.getValidity());

This worked for me. I suggest this as an official commit.

Best regards,
Ivan Lagunov

Mime
View raw message