You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by ri...@peoplesoft.com on 2004/11/20 16:58:32 UTC

Has anyone tried the latest castor?

I tried replacing the castor-0.9.4.1-xml.jar with the latest release from
www.castor.org, castor-0.9.5.4-xml.jar, and ran into what looks like
incompatible changes in castor behavior. But since I'm a newbie to castor I
thought I would ask the list.

With the latest release, the loadMapping( String fileName ) method used in
the pluto portalImpl services (ex: portlet definition registry) all get
"file not found" because castor double-adds the path of the file by the
time they get around to calling the castor DTDResolver.resolveEntity. Is
this making sense to anyone? Does anyone have more on this?

The workaround I put on my system is to just call loadMapping( InputSource
) with an already opened stream instead...

So for example this:

        try
        {
            this.mappingPortletXml.loadMapping(_mapping);
        }
        catch (Exception e)
        {
            log.error("Failed to load mapping file "+_mapping,e);
            throw e;
        }

Becomes this:

        // changed loadMapping call from passing in full path to
InputSource instead
        // castor-0.9.5.4 can't handle full file names... sets base and
still appends full path
        FileInputStream fis = null;
        try
        {
            fis = new FileInputStream(_mapping);
            InputSource src = new InputSource(new
BufferedInputStream(fis));
            this.mappingPortletXml.loadMapping(src);
        }
        catch (Exception e)
        {
            log.error("Failed to load mapping file "+_mapping,e);
            throw e;
        }
        finally
        {
            try {
                if( fis != null )
                    fis.close();
            } catch( Exception x ) {}
        }



Re: Has anyone tried the latest castor?

Posted by Ralph Goers <Ra...@dslextreme.com>.
ricky_frost@peoplesoft.com wrote:

>I tried replacing the castor-0.9.4.1-xml.jar with the latest release from
>www.castor.org, castor-0.9.5.4-xml.jar, and ran into what looks like
>incompatible changes in castor behavior. But since I'm a newbie to castor I
>thought I would ask the list.
>
>With the latest release, the loadMapping( String fileName ) method used in
>the pluto portalImpl services (ex: portlet definition registry) all get
>"file not found" because castor double-adds the path of the file by the
>time they get around to calling the castor DTDResolver.resolveEntity. Is
>this making sense to anyone? Does anyone have more on this?
>  
>
Funny you should bring this up.  All day yesterday I was trying to get 
Cocoon to store its portal profiles. It uses Castor and similar mappings 
as Pluto. I found that it reads the configurations just fine, but when 
writing the objects out it creates files that cannot be reread.  It just 
doesn't seem to handle the stuff defined as collection="map" very well.  
I tried it with the latest version of castor but it made no difference.  
However, I didn't have the problems you are experiencing.

Ralph