void save()

in common/src/main/java/com/microsoft/alm/storage/InsecureFileBackend.java [90:114]


    void save() {
        if (backingFile != null) {
            // TODO: 449510: consider creating a backup of the file, if it exists, before overwriting it
            FileOutputStream fos = null;
            try {
                fos = new FileOutputStream(backingFile);
                toXml(fos);
            } catch (final FileNotFoundException e) {
                throw new Error("Error during save()", e);
            } finally {
                IOHelper.closeQuietly(fos);
            }

            if (!backingFile.setReadable(false, false)
                    || !backingFile.setWritable(false, false)
                    || !backingFile.setExecutable(false, false)) {
                logger.warn("Unable to remove file permissions for everybody: {}", backingFile);
            }
            if (!backingFile.setReadable(true, true)
                    || !backingFile.setWritable(true, true)
                    || !backingFile.setExecutable(false, true)) {
                logger.warn("Unable to set file permissions for owner: {}", backingFile);
            }
        }
    }