cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Strange code in JXPathBindingBase
Date Wed, 31 Jan 2007 13:40:21 GMT
While looking at our code I came across this rather strange looking
implementation in org.apache.cocoon.forms.binding.JXPathBindingBase

    public boolean isValid() {
        if (this.enclosingLibrary != null) {
            if (parent != null) {
                return parent.isValid();
            }
            return true; // no library used
        }

        try {
            return !this.enclosingLibrary.dependenciesHaveChanged();
        } catch (Exception e) {
            getLogger().error("Error checking dependencies!", e);
            throw new NestableRuntimeException("Error checking
dependencies!", e);
        }
    }

If the try-catch block is reached, this.enclosingLibrary is null! And
this clearly results in an NPE!
So what is wrong here? I guess that the "if" should read:
if ( this.enclosingLibrary == null)
but that's just a guess.

Carsten
-- 
Carsten Ziegeler
http://www.osoco.org/weblogs/rael/

Mime
View raw message