[opencms-dev] need help: error replacing file content

andrea cossu andrea.cossu at gruppoatlantis.com
Wed Apr 18 11:32:12 CEST 2007


Hi all,
i'm trying to replace the content of a resource using this code:

    file = cms.getCmsObject().readFile(filename);
    obj = cms.getCmsObject();
    xmlcontent = CmsXmlContentFactory.unmarshal(cms.getCmsObject(), file);
    content = xmlcontent.toString();
    ..........

    file.setContents(content.getBytes());
    List aa = obj.readPropertyObjects(filename,false);
    int id = obj.readResource(filename).getTypeId();
    obj.replaceResource(filename,id,content.getBytes(),aa);

but i get an error:
javax.servlet.ServletException: Error replacing the content, type and 
properties of resource......

what am'i wrong?

thanks

andrea 






More information about the opencms-dev mailing list