public boolean compareTo(SVNWCProperties properties, ISVNPropertyComparator comparator) throws SVNException { boolean equals = true; Collection props1 = properties(null); Collection props2 = properties.properties(null); // missed in props2. Collection tmp = new TreeSet(props1); tmp.removeAll(props2); for (Iterator props = tmp.iterator(); props.hasNext(); ) { String missing = (String) props.next(); comparator.propertyDeleted(missing); equals = false; } // added in props2. tmp = new TreeSet(props2); tmp.removeAll(props1); File tmpFile = null; File tmpFile1 = null; File tmpFile2 = null; OutputStream os = null; InputStream is = null; InputStream is1 = null; InputStream is2 = null; for (Iterator props = tmp.iterator(); props.hasNext(); ) { String added = (String) props.next(); try { tmpFile = SVNFileUtil.createUniqueFile( getFile().getParentFile(), getFile().getName(), ".tmp", true); os = SVNFileUtil.openFileForWriting(tmpFile); properties.getPropertyValue(added, os); SVNFileUtil.closeFile(os); is = SVNFileUtil.openFileForReading(tmpFile, SVNLogType.WC); comparator.propertyAdded(added, is, (int) tmpFile.length()); equals = false; SVNFileUtil.closeFile(is); } finally { if (tmpFile != null) { tmpFile.delete(); } SVNFileUtil.closeFile(os); SVNFileUtil.closeFile(is); tmpFile = null; is = null; os = null; } } // changed in props2 props2.retainAll(props1); for (Iterator props = props2.iterator(); props.hasNext(); ) { String changed = (String) props.next(); try { tmpFile1 = SVNFileUtil.createUniqueFile( getFile().getParentFile(), getFile().getName(), ".tmp1", true); tmpFile2 = SVNFileUtil.createUniqueFile( getFile().getParentFile(), getFile().getName(), ".tmp2", true); os = SVNFileUtil.openFileForWriting(tmpFile1); getPropertyValue(changed, os); os.close(); os = SVNFileUtil.openFileForWriting(tmpFile2); properties.getPropertyValue(changed, os); os.close(); if (tmpFile2.length() != tmpFile1.length()) { is = SVNFileUtil.openFileForReading(tmpFile2, SVNLogType.WC); comparator.propertyChanged(changed, is, (int) tmpFile2.length()); equals = false; SVNFileUtil.closeFile(is); } else { is1 = SVNFileUtil.openFileForReading(tmpFile1, SVNLogType.WC); is2 = SVNFileUtil.openFileForReading(tmpFile2, SVNLogType.WC); boolean differs = false; for (int i = 0; i < tmpFile1.length(); i++) { if (is1.read() != is2.read()) { differs = true; break; } } SVNFileUtil.closeFile(is1); SVNFileUtil.closeFile(is2); if (differs) { is2 = SVNFileUtil.openFileForReading(tmpFile2, SVNLogType.WC); comparator.propertyChanged(changed, is2, (int) tmpFile2.length()); equals = false; SVNFileUtil.closeFile(is2); } } } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e, SVNLogType.WC); } finally { if (tmpFile2 != null) { tmpFile2.delete(); } if (tmpFile1 != null) { tmpFile1.delete(); } SVNFileUtil.closeFile(os); SVNFileUtil.closeFile(is); SVNFileUtil.closeFile(is1); SVNFileUtil.closeFile(is2); os = null; tmpFile1 = tmpFile2 = null; is = is1 = is2 = null; } } return equals; }