You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <vg...@hns.com> on 2000/08/25 15:43:18 UTC

RE: org.apache.cocoon.sitemap.SitemapManager.hasChanged()

> From: Giacomo Pati [mailto:pati_giacomo@yahoo.com]
> --- Vadim Gritsenko <vg...@hns.com> wrote:
> > Hi All,
> > 
> > It seems there is error in this method. It returns "true"
> > always now, and I think it should return false sometimes,
> > like this:
> > 
> >  public boolean hasChanged () {
> >   SitemapHandler sitemapHandler = null;
> >   Enumeration enum = sitemaps.elements();
> >   while (enum.hasMoreElements()) {
> >    sitemapHandler = (SitemapHandler) enum.nextElement ();
> >    if (sitemapHandler != null) {
> >     if (sitemapHandler.hasChanged())
> >      return true;
> >    }
> >   }
> >   return false;
> >  }
> 
> I've checked this and cannot reproduce it. It returns false almost al
> the times. It works just as excpected.
> 
> Giacomo

Yes, above piece of code works fine, but in CVS
(CVS $Revision: 1.1.2.8 $ $Date: 2000/08/21 17:35:31 $)
we have the following:

    public boolean hasChanged () {
        SitemapHandler sitemapHandler = null;
        Enumeration enum = sitemaps.elements();
        while (enum.hasMoreElements()) {
            sitemapHandler = (SitemapHandler) enum.nextElement ();
            if (sitemapHandler != null) {
                if (sitemapHandler.hasChanged())
                    return true;
            }
        }
        return true;
    }

which obviously returns true everytime (there is only two "return"s,
and both of them - "true"). I think, this should be corrected.
Please, correct this - if I am right.


Vadim