if (os != null) { try { os.close(); } catch (IOException e) { } }
SVNFileUtil.closeFile(os);
    public SVNStatusType mergeProperties(String name, Map changedProperties, Map locallyChanged, boolean updateBaseProps, SVNLog log) throws SVNException {        changedProperties = changedProperties == null ? Collections.EMPTY_MAP : changedProperties;        locallyChanged = locallyChanged == null ? Collections.EMPTY_MAP : locallyChanged;        SVNProperties working = getProperties(name, false);        SVNProperties workingTmp = getProperties(name, true);        SVNProperties base = getBaseProperties(name, false);        SVNProperties baseTmp = getBaseProperties(name, true);        working.copyTo(workingTmp);        if (updateBaseProps) {            base.copyTo(baseTmp);        }                Collection conflicts = new ArrayList();        SVNStatusType result = changedProperties.isEmpty() ? SVNStatusType.UNCHANGED : SVNStatusType.CHANGED;        for (Iterator propNames = changedProperties.keySet().iterator(); propNames.hasNext();) {            String propName = (String) propNames.next();            String propValue = (String) changedProperties.get(propName);            DebugLog.log("merging prop change: " + propName + "=" + propValue);            if (updateBaseProps) {                baseTmp.setPropertyValue(propName, propValue);            }                        if (locallyChanged.containsKey(propName)) {                String workingValue = (String) locallyChanged.get(propName);                String conflict = null;                //if (workingValue != null) {                    if (workingValue == null && propValue != null) {                        conflict = MessageFormat.format("Property ''{0}'' locally deleted, but update sets it to ''{1}''\n",                                 new String[] {propName, propValue});                                            } else if (workingValue != null && propValue == null) {                        conflict = MessageFormat.format("Property ''{0}'' locally changed to ''{1}'', but update deletes it\n",                                 new String[] {propName, workingValue});                                            } else if (workingValue != null && !workingValue.equals(propValue)) {                        conflict = MessageFormat.format("Property ''{0}'' locally changed to ''{1}'', but update sets it to ''{2}''\n",                                 new String[] {propName, workingValue, propValue});                                            }                    if (conflict != null) {                                  conflicts.add(conflict);                        continue;                    }                    result = SVNStatusType.MERGED;                //}            }            DebugLog.log("setting tmp wc value: " + propName + "=" + propValue);            workingTmp.setPropertyValue(propName, propValue);        }                // now log all.        Map command = new HashMap();        if (log != null) {            command.put(SVNLog.NAME_ATTR, workingTmp.getPath());            command.put(SVNLog.DEST_ATTR, working.getPath());            log.addCommand(SVNLog.MOVE, command, false);            command.clear();            command.put(SVNLog.NAME_ATTR, working.getPath());            log.addCommand(SVNLog.READONLY, command, false);                if (updateBaseProps) {                command.put(SVNLog.NAME_ATTR, baseTmp.getPath());                command.put(SVNLog.DEST_ATTR, base.getPath());                log.addCommand(SVNLog.MOVE, command, false);                command.clear();                command.put(SVNLog.NAME_ATTR, base.getPath());                log.addCommand(SVNLog.READONLY, command, false);            }        }        if (!conflicts.isEmpty()) {            result = SVNStatusType.CONFLICTED;            String prejTmpPath = "".equals(name) ? ".svn/tmp/dir_conflicts" : ".svn/tmp/props/" + name;            File prejTmpFile = SVNFileUtil.createUniqueFile(getRoot(), prejTmpPath, ".prej");            prejTmpPath = SVNFileUtil.getBasePath(prejTmpFile);                            String prejPath = getEntries().getEntry(name, true).getPropRejectFile();            getEntries().close();            if (prejPath == null) {                prejPath = "".equals(name) ? "dir_conflicts" : name;                File prejFile = SVNFileUtil.createUniqueFile(getRoot(), prejPath, ".prej");                prejPath = SVNFileUtil.getBasePath(prejFile);            }            OutputStream os = null;            try {                os = new FileOutputStream(new File(getRoot(), prejTmpPath));                for (Iterator lines = conflicts.iterator(); lines.hasNext();) {                    String line = (String) lines.next();                    os.write(line.getBytes("UTF-8"));                }            } catch (IOException e) {                SVNErrorManager.error(0, e);            } finally {                if (os != null) {                    try {                        os.close();                    } catch (IOException e) {                    }                }            }            if (log != null) {                command.put(SVNLog.NAME_ATTR, prejTmpPath);                command.put(SVNLog.DEST_ATTR, prejPath);                log.addCommand(SVNLog.APPEND, command, false);                command.clear();                command.put(SVNLog.NAME_ATTR, prejTmpPath);                log.addCommand(SVNLog.DELETE, command, false);                command.clear();                    command.put(SVNLog.NAME_ATTR, name);                command.put(SVNProperty.shortPropertyName(SVNProperty.PROP_REJECT_FILE), prejPath);                log.addCommand(SVNLog.MODIFY_ENTRY, command, false);            }        }        if (log == null) {            workingTmp.delete();            baseTmp.delete();        }        return result;    }