SVNDebugLog.log(bos.toString());
SVNDebugLog.logInfo(bos.toString());
    public void displayFileDiff(String path, File file1, File file2,            String rev1, String rev2, String mimeType1, String mimeType2, OutputStream result) throws SVNException {        path = getDisplayPath(path);        int i = 0;        for(; i < myAnchorPath1.length() && i < myAnchorPath2.length() &&            myAnchorPath1.charAt(i) == myAnchorPath2.charAt(i); i++) {}        if (i < myAnchorPath1.length() || i < myAnchorPath2.length()) {            if (i == myAnchorPath1.length()) {                i = myAnchorPath1.length() - 1;            }            for(; i > 0 && myAnchorPath1.charAt(i) != '/'; i--) {}        }        String p1 = myAnchorPath1.substring(i) ;        String p2 = myAnchorPath2.substring(i);                if (p1.length() == 0) {            p1 = path;        } else if (p1.charAt(0) == '/') {            p1 = path + "\t(..." + p1 + ")";        } else {            p1 = path + "\t(.../" + p1 + ")";        }        if (p2.length() == 0) {            p2 = path;        } else if (p2.charAt(0) == '/') {            p2 = path + "\t(..." + p2 + ")";        } else {            p2 = path + "\t(.../" + p2 + ")";        }                // if anchor1 is the same as anchor2 just use path.                // if anchor1 differs from anchor2 =>        // condence anchors (get common root and remainings).                rev1 = rev1 == null ? WC_REVISION_LABEL : rev1;        rev2 = rev2 == null ? WC_REVISION_LABEL : rev2;        ByteArrayOutputStream bos = new ByteArrayOutputStream();        try {            if (file2 == null && !isDiffDeleted()) {                bos.write("Index: ".getBytes(getEncoding()));                bos.write(path.getBytes(getEncoding()));                bos.write(" (deleted)".getBytes(getEncoding()));                bos.write(EOL);                bos.write(HEADER_SEPARATOR);                bos.write(EOL);                bos.close();                bos.writeTo(result);                return;            }            bos.write("Index: ".getBytes(getEncoding()));            bos.write(path.getBytes(getEncoding()));            bos.write(EOL);            bos.write(HEADER_SEPARATOR);            bos.write(EOL);        } catch (IOException e) {            try {                bos.close();                bos.writeTo(result);                SVNDebugLog.log(bos.toString());            } catch (IOException inner) {            }            SVNErrorManager.error("svn: Failed to save diff data: " + e.getMessage());        }        if (!isForcedBinaryDiff() && (SVNProperty.isBinaryMimeType(mimeType1) || SVNProperty.isBinaryMimeType(mimeType2))) {            try {                bos.write("Cannot display: file marked as binary type.".getBytes(getEncoding()));                bos.write(EOL);                if (SVNProperty.isBinaryMimeType(mimeType1)                        && !SVNProperty.isBinaryMimeType(mimeType2)) {                    bos.write("svn:mime-type = ".getBytes(getEncoding()));                    bos.write(mimeType1.getBytes(getEncoding()));                    bos.write(EOL);                } else if (!SVNProperty.isBinaryMimeType(mimeType1)                        && SVNProperty.isBinaryMimeType(mimeType2)) {                    bos.write("svn:mime-type = ".getBytes(getEncoding()));                    bos.write(mimeType2.getBytes(getEncoding()));                    bos.write(EOL);                } else if (SVNProperty.isBinaryMimeType(mimeType1)                        && SVNProperty.isBinaryMimeType(mimeType2)) {                    if (mimeType1.equals(mimeType2)) {                        bos.write("svn:mime-type = ".getBytes(getEncoding()));                        bos.write(mimeType2.getBytes(getEncoding()));                        bos.write(EOL);                    } else {                        bos.write("svn:mime-type = (".getBytes(getEncoding()));                        bos.write(mimeType1.getBytes(getEncoding()));                        bos.write(", ".getBytes(getEncoding()));                        bos.write(mimeType2.getBytes(getEncoding()));                        bos.write(")".getBytes(getEncoding()));                        bos.write(EOL);                    }                }            } catch (IOException e) {                SVNErrorManager.error("svn: Failed to save diff data: " + e.getMessage());            } finally {                try {                    bos.close();                    bos.writeTo(result);                    SVNDebugLog.log(bos.toString());                } catch (IOException e) {                }            }            return;        }        // put header fields.        try {            bos.write("--- ".getBytes(getEncoding()));            bos.write(p1.getBytes(getEncoding()));            bos.write("\t".getBytes(getEncoding()));            bos.write(rev1.getBytes(getEncoding()));            bos.write(EOL);            bos.write("+++ ".getBytes(getEncoding()));            bos.write(p2.getBytes(getEncoding()));            bos.write("\t".getBytes(getEncoding()));            bos.write(rev2.getBytes(getEncoding()));            bos.write(EOL);        } catch (IOException e) {            try {                bos.close();                bos.writeTo(result);            } catch (IOException inner) {            }            SVNErrorManager.error("svn: Failed to save diff data: " + e.getMessage());        }        InputStream is1 = null;        InputStream is2 = null;        try {            is1 = file1 == null ? EMPTY_FILE_IS : SVNFileUtil.openFileForReading(file1);            is2 = file2 == null ? EMPTY_FILE_IS : SVNFileUtil.openFileForReading(file2);            QDiffUniGenerator.setup();            Map generatorProperties = new HashMap();            generatorProperties.put(QDiffUniGenerator.COMPARE_EOL_PROPERTY, Boolean.TRUE.toString());            QDiffGenerator generator = QDiffManager.getDiffGenerator(QDiffUniGenerator.TYPE, generatorProperties);            Writer writer = new OutputStreamWriter(bos, getEncoding());            QDiffManager.generateTextDiff(is1, is2, getEncoding(), writer, generator);            writer.flush();            writer.close();        } catch (IOException e) {            SVNErrorManager.error("svn: Failed to save diff data: " + e.getMessage());        } finally {            SVNFileUtil.closeFile(is1);            SVNFileUtil.closeFile(is2);            try {                bos.close();                bos.writeTo(result);                SVNDebugLog.log(bos.toString());            } catch (IOException inner) {                //            }        }    }