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/24 21:14:59 UTC

org.apache.cocoon.sitemap.SitemapManager.hasChaged()

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;
 }


Vadim


Re: org.apache.cocoon.sitemap.SitemapManager.hasChaged()

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
> Vadim Gritsenko 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;
> >  }
> 
> Good catch. Patch applied.

I've commited it right now !?!

> 
> BTW, people, the use of "Vector", "Stack", "Hashtable" and "Enumerator"
> is to be considered deprecated for a number of reasons:

Ok, I knew that but I'll check again the code I've written ASAP.

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: org.apache.cocoon.sitemap.SitemapManager.hasChaged()

Posted by Stefano Mazzocchi <st...@apache.org>.
Vadim Gritsenko 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;
>  }

Good catch. Patch applied.

BTW, people, the use of "Vector", "Stack", "Hashtable" and "Enumerator"
is to be considered deprecated for a number of reasons:

1) the are "all" synchronized. Sure there are cases when you need a
synchronized collection container, but the new Collection API forces you
to declare so and it's much, much, much, easier to program with and
safer on the long run.

2) they all provide "fake" methods and are not directly compatible with
the other collection classes (expecially enumerator and iterator)

3) the new (well, new since Java 1.1) Java Collection API is a piece of
art. It's pure beauty made API. It was designed with the help of Doug
Lea and Doug is one hell of a proponent of good design patterns (see his
book on "concurrent programming in java" and his page on design patterns
and software engineering in general)

So, keep in mind Cocoon won't turn beta if even only one of these
preistoric containers is used in the codebase.

You have been warned.

(Vadim, this is not directed to you, I just used the occasion, no
offense intended)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------