SVNFileUtil.closeFile(is);
    private boolean importFile(File rootFile, File file, SVNFileType fileType,            String filePath, ISVNEditor editor) throws SVNException {        if (fileType == null || fileType == SVNFileType.UNKNOWN) {            SVNErrorManager.error("svn: unknown or unversionable type for '" + file + "'");        }        editor.addFile(filePath, null, -1);        String mimeType = null;        Map autoProperties = new HashMap();        if (fileType != SVNFileType.SYMLINK) {            autoProperties = getOptions().applyAutoProperties(file.getName(), autoProperties);            if (!autoProperties.containsKey(SVNProperty.MIME_TYPE)) {                mimeType = SVNFileUtil.detectMimeType(file);                if (mimeType != null) {                    autoProperties.put(SVNProperty.MIME_TYPE, mimeType);                    autoProperties.remove(SVNProperty.EOL_STYLE);                }            }            if (!autoProperties.containsKey(SVNProperty.EXECUTABLE) && SVNFileUtil.isExecutable(file)) {                autoProperties.put(SVNProperty.EXECUTABLE, "");            }        } else {            autoProperties.put(SVNProperty.SPECIAL, "*");        }        for (Iterator names = autoProperties.keySet().iterator(); names                .hasNext();) {            String name = (String) names.next();            String value = (String) autoProperties.get(name);            if (SVNProperty.EOL_STYLE.equals(name) && value != null) {                if (SVNProperty.isBinaryMimeType((String) autoProperties.get(SVNProperty.MIME_TYPE))) {                    SVNDebugLog.logInfo("svn: File '" + file + "' has binary mime-type, svn:eol-style property is not applicable");                    continue;                }else if (!SVNTranslator.checkNewLines(file)) {                    SVNDebugLog.logInfo("svn: File '" + file + "' has inconsistent newlines");                    continue;                }             }            editor.changeFileProperty(filePath, name, value);        }        // send "adding"        SVNEvent addedEvent = SVNEventFactory.createCommitEvent(rootFile, file,                SVNEventAction.COMMIT_ADDED, SVNNodeKind.FILE, mimeType);        handleEvent(addedEvent, ISVNEventHandler.UNKNOWN);        editor.applyTextDelta(filePath, null);        // translate and send file.        String eolStyle = (String) autoProperties.get(SVNProperty.EOL_STYLE);        String keywords = (String) autoProperties.get(SVNProperty.KEYWORDS);        boolean special = autoProperties.get(SVNProperty.SPECIAL) != null;        File tmpFile = null;        if (eolStyle != null || keywords != null || special) {            byte[] eolBytes = SVNTranslator.getBaseEOL(eolStyle);            Map keywordsMap = keywords != null ? SVNTranslator.computeKeywords(                    keywords, null, null, null, null) : null;            tmpFile = SVNFileUtil.createUniqueFile(file.getParentFile(), file                    .getName(), ".tmp");            SVNTranslator.translate(file, tmpFile, eolBytes, keywordsMap,                    special, false);        }        File importedFile = tmpFile != null ? tmpFile : file;        String checksum = SVNFileUtil.computeChecksum(importedFile);        OutputStream os = editor.textDeltaChunk(filePath, SVNDiffWindowBuilder                .createReplacementDiffWindow(importedFile.length()));        InputStream is = SVNFileUtil.openFileForReading(importedFile);        int r;        try {            while ((r = is.read()) >= 0) {                os.write(r);            }        } catch (IOException e) {            SVNErrorManager.error("svn: IO error while importing file '" + file                    + "': " + e.getMessage());        } finally {            try {                os.close();            } catch (IOException e) {                SVNErrorManager.error("svn: IO error while importing file '"                        + file + "': " + e.getMessage());            }            if (tmpFile != null) {                tmpFile.delete();            }        }        editor.textDeltaEnd(filePath);        editor.closeFile(filePath, checksum);        return true;    }