protected synchronized void saveContent(String content) throws Exception {
    if (content == null) {
      return;
    }

    final String separator = System.getProperty("line.separator");

    if (content.endsWith("|")) {
      content += separator;
    }

    content = content.replaceAll("\r\n", separator);

    String contentPath = getFileSystemPath() + contentFilename;
    final File output = new File(contentPath);
    OutputStreamWriter writer = null;
    try {
      if (output.exists()) cmSystem.edit(contentPath);
      writer = new OutputStreamWriter(new FileOutputStream(output), "UTF-8");
      writer.write(content);
    } finally {
      if (writer != null) {
        writer.close();
        cmSystem.update(contentPath);
      }
    }
  }
 @Override
 public void removeChildPage(final String name) throws Exception {
   super.removeChildPage(name);
   String pathToDelete = getFileSystemPath() + "/" + name;
   final File fileToBeDeleted = new File(pathToDelete);
   cmSystem.preDelete(pathToDelete);
   FileUtil.deleteFileSystemDirectory(fileToBeDeleted);
   cmSystem.delete(pathToDelete);
 }
 private void createDirectoryIfNewPage(FileSystem fileSystem) throws Exception {
   String pagePath = getFileSystemPath();
   if (!fileSystem.exists(pagePath)) {
     fileSystem.makeDirectory(pagePath);
     cmSystem.update(pagePath);
   }
 }
 protected synchronized void saveAttributes(final WikiPageProperties attributes) throws Exception {
   OutputStream output = null;
   String propertiesFilePath = "<unknown>";
   try {
     propertiesFilePath = getFileSystemPath() + propertiesFilename;
     File propertiesFile = new File(propertiesFilePath);
     if (propertiesFile.exists()) cmSystem.edit(propertiesFilePath);
     output = new FileOutputStream(propertiesFile);
     WikiPageProperties propertiesToSave = new WikiPageProperties(attributes);
     removeAlwaysChangingProperties(propertiesToSave);
     propertiesToSave.save(output);
   } catch (final Exception e) {
     System.err.println(
         "Failed to save properties file: \"" + propertiesFilePath + "\" (exception: " + e + ").");
     e.printStackTrace();
     throw e;
   } finally {
     if (output != null) {
       output.close();
       cmSystem.update(propertiesFilePath);
     }
   }
 }