/** * Writes the xml content to the vfs and re-initializes the member variables.<p> * * @param cms the cms context * @param file the file to write to * @param content the content * @param encoding the file encoding * * @return the content * * @throws CmsException if writing the file fails */ private CmsXmlContent writeContent(CmsObject cms, CmsFile file, CmsXmlContent content, String encoding) throws CmsException { String decodedContent = content.toString(); try { file.setContents(decodedContent.getBytes(encoding)); } catch (UnsupportedEncodingException e) { throw new CmsException( org.opencms.workplace.editors.Messages.get().container( org.opencms.workplace.editors.Messages.ERR_INVALID_CONTENT_ENC_1, file.getRootPath()), e); } // the file content might have been modified during the write operation file = cms.writeFile(file); return CmsXmlContentFactory.unmarshal(cms, file); }
/** * Writes the xml content to the vfs and re-initializes the member variables.<p> * * @throws CmsException if writing the file fails */ private void writeContent() throws CmsException { String decodedContent = m_content.toString(); try { m_file.setContents(decodedContent.getBytes(getFileEncoding())); } catch (UnsupportedEncodingException e) { throw new CmsException(Messages.get().container(Messages.ERR_INVALID_CONTENT_ENC_1, getParamResource()), e); } // the file content might have been modified during the write operation m_file = getCloneCms().writeFile(m_file); m_content = CmsXmlContentFactory.unmarshal(getCloneCms(), m_file); } }
String decodedContent = content.toString(); try { file.setContents(decodedContent.getBytes(content.getEncoding()));
String decodedContent = content.toString(); try { file.setContents(decodedContent.getBytes(content.getEncoding()));
/** * Writes the xml content to the vfs and re-initializes the member variables.<p> * * @throws CmsException if writing the file fails */ private void writeContent() throws CmsException { String decodedContent = m_content.toString(); try { m_file.setContents(decodedContent.getBytes(getFileEncoding())); } catch (UnsupportedEncodingException e) { throw new CmsException(Messages.get().container(Messages.ERR_INVALID_CONTENT_ENC_1, getParamResource()), e); } // the file content might have been modified during the write operation CmsObject cloneCms = getCloneCms(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); m_file = cloneCms.writeFile(m_file); m_content = CmsXmlContentFactory.unmarshal(cloneCms, m_file); } }
cmsFile = cmsObject.readFile(cmsResource); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), cmsFile); fileXmlContent = xmlContent.toString(); } catch (CmsException e) { m_errorTransform += 1;