cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: org.apache.cocoon.sitemap.SitemapManager.hasChaged()
Date Fri, 25 Aug 2000 10:13:27 GMT
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.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message