boolean (DiffElement<?> file1, DiffElement<?> file2) { if (file1.isContainer() || file2.isContainer()) return false; if (file1.getFileType().isBinary() || file2.getFileType().isBinary()) { return isEqualContents(file1, file2); } try { byte[] content1 = file1.getContent(); byte[] content2 = file2.getContent(); if (Arrays.equals(content1, content2)) return true; if (content1 == null || content2 == null) return false; String text1 = CharsetToolkit.tryDecodeString(content1, file1.getCharset()); if (text1 == null) return false; String text2 = CharsetToolkit.tryDecodeString(content2, file2.getCharset()); if (text2 == null) return false; String convertedText1 = StringUtil.convertLineSeparators(text1); String convertedText2 = StringUtil.convertLineSeparators(text2); return StringUtil.equals(convertedText1, convertedText2); } catch (IOException e) { LOG.warn(e); return false; } }