[opencms-dev] Java class to translate XML code contained in the VFS in HTML page source code

Hartmann, Waehrisch & Feykes GmbH hartmann at waehrisch-feykes.de
Wed Nov 5 10:06:00 CET 2003


Hi Massimiliano,

do you have an initialized CmsObject?
Which JDK do you use? My String class seems to be very different to yours.
Anyway, the error seems to occur during caching. You can go deeper and try
this:
CmsFile file = cmso.readFile("/system/bodies/...");
CmsXmlTemplateFile cf = new CmsXmlTemaplteFile(cmso, file);
String result = cf.getTemplateContent(null, null, null);

Bye,
Stephan

----- Original Message ----- 
From: "Massimiliano" <massyc at mclink.it>
To: <opencms-dev at opencms.org>
Sent: Wednesday, November 05, 2003 1:22 AM
Subject: Re: [opencms-dev] Java class to translate XML code contained in the
VFS in HTML page source code


> Hi Stephan,
> I modified my source code using the CmsXmlTemplate class but I receive a
> NullPointerException.
> Do you have idea to resolve this problem?
>
> This is the exception trace:
>
> [CmsElementXml (CmsXmlTemplate/index.html)] adding variant "key_http_"
> to cache.
> java.lang.NullPointerException
> at java.lang.String$2.run(String.java:267)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.lang.String$CharToByteCache.getConverter(String.java:263)
> at java.lang.String.getCTBConverter(String.java:408)
> at java.lang.String.getBytes(String.java:1193)
> at
>
com.opencms.template.cache.A_CmsElement.resolveVariant(A_CmsElement.java:425
)
> at
>
com.opencms.template.CmsXmlTemplate.startProcessing(CmsXmlTemplate.java:1314
)
> at com.opencms.template.CmsXmlTemplate.getContent(CmsXmlTemplate.java:164)
> at
>
com.ibm.opencms.integration.OpenCMSConnector.getPage(OpenCMSConnector.java:9
7)
> at
>
com.ibm.opencms.integration.test.OpenCMSConnectorTest.main(OpenCMSConnectorT
est.java:27)
>
> Thanks again,
> Massimiliano.
>
>
>
> Stephan Hartmann wrote:
>
> > Hi Massimiliano,
> >
> > the launcher mechanism calls a getContent method of an instance of
> > com.opencms.template.CmsXmlTemplate and writes the result (a byte[])
> > directly into the http response.
> > You should try something like this:
> >
> > CmsXmlTemplate cxl = new CmsXmlTemplate();
> > byte[] result = cxl.getContent(cmso, "/vfs/path/to/file", null, new
> > Hashtable(), null);
> >
> > Bye,
> > Stephan
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>




More information about the opencms-dev mailing list