[opencms-dev] bug in org.opencms.frontend.photoalbum, fix suggestion

Jens-U. Mozdzen jmozdzen at mozdzen.de
Fri May 5 19:19:58 CEST 2006


Hello list,

I believe I have stumbled across a bug in
org.opencms.frontend,photoalbum, namely in the setConfiguration() method
of CmsPhotoAlbumBean:

When instantiating CmsPhotoAlbumBean with an available
CmsPhotoAlbumConfiguration (as XML file, type photoalbum), the init()
method is called by the constructor. Init(), amongst other steps, stores
the configuration object and calls the calculatePageData() method to set
up the instance.

The album's HTML code can properly be output via the displayAlbum() method.

When instantiating CmsPhotoAlbumBean *without* an XML config file and
providing the configuration via the setConfiguration() method,
setConfiguration() only stores the configuration object but *does not*
call calculatePageData(). When calling displayAlbum(), the resulting
HTML code is an empty table.

I created a derived class, where calculatePageData() is called after
setConfiguration() - leading to proper HTML output by subsequent
displayAlbum() calls.

The correct fix would be to include the calculatePageData() in the
setConfiguration() method, after storing the config object.

A side note: Why were the developers of the corresponding
CmsPhotoAlbumConfiguration class so restrictive (protected methods)
about the methods to set the various configuration parameters? I for one
had the requirement to set ie the gallery path individually, so I could
include the album inside my own XML datatype. Ofcourse the
(syntactically) legal way is to create a derived class, where I could
call the (protected) getVfsPathGallery() method providing my own values
- but I see no obvious reason to make it that complicated - the methods
could simply be public and the CmsPhotoAlbumConfiguration class could be
used directly ;-). Did I miss something?

With regards,
Jens



More information about the opencms-dev mailing list