[opencms-dev] New API and CmsExceptions in Version 6.x..?

Chris Stephens sub1 at elucid.org
Wed Dec 14 14:11:01 CET 2005


Hi folks,

I am trying to port some of Matt Butcher's code from "Building  
Websites with OpenCms" (which was written for Version 5.x) to Version  
6.0 code.

A lot of the API has changed and I have managed to get that all fine  
(as far as I can tell) but the code has problems with CmsExceptions.

Specifically, I get this when I compile:

CmsXslTransformer.java:59: cannot resolve symbol
symbol : constructor CmsException  
(java.lang.String,javax.xml.transform.TransformerConfigurationException)
location: class org.OpenCms.main.CmsException
throw new CmsException( "Cannot create XSLT transformer.", tce );
^
CmsXslTransformer.java:61: cannot resolve symbol
symbol : constructor CmsException  
(java.lang.String,javax.xml.transform.TransformerException)
location: class org.OpenCms.main.CmsException
throw new CmsException( "Cannot use XSLT transformer.", te );
^
2 errors


The relvant bits of code are as follows:

import org.OpenCms.main.CmsException;

and

    public CmsXslTransformer( String xsltStylesheet, CmsObject cms )
          throws CmsException {
       this.cms = cms;
       try {
          TransformerFactory tf = TransformerFactory.newInstance();
          CmsFile xsltFile = cms.readFile( xsltStylesheet );
          Source s = this.getCmsFileSource( xsltFile );
          this.transformer = tf.newTransformer( s );
       } catch ( TransformerConfigurationException tce ) {
          throw new CmsException( "Cannot create XSLT transformer.",  
tce );
       } catch ( TransformerException te ) {
          throw new CmsException( "Cannot use XSLT transformer.", te );
       }
    }


Can anyone help me? I've tried to glean how exceptions are done in  
6.0 from the Javadoc but it's not coming clear to me yet...

Thanks in advance,

Chris
PS the book is fantastic even though it's a version old. I hope Matt  
does a new version for 6 - I will buy it immediately when he does...  
Thanks, Matt!



More information about the opencms-dev mailing list