From 415fb8c71084e7628f46667dca2d289a730e35b0 Mon Sep 17 00:00:00 2001
From: Sean-M <Smoss117@gmail.com>
Date: Thu, 7 Feb 2013 12:17:23 -0500
Subject: [PATCH] Now using CygDiff

---
 .../datamodel/DataModelTestSuite.java         |  2 +-
 .../org/sleuthkit/datamodel/DiffUtil.java     | 87 -------------------
 2 files changed, 1 insertion(+), 88 deletions(-)
 delete mode 100644 bindings/java/test/org/sleuthkit/datamodel/DiffUtil.java

diff --git a/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java b/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java
index 33f9620ed..7a67c0300 100644
--- a/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java
+++ b/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java
@@ -458,7 +458,7 @@ protected static boolean comparecontent(String original, String results) {
 					in2.close();
 					f1.close();
 					f2.close();
-					DiffUtil.getDiff(fi1.getAbsolutePath(), fi2.getAbsolutePath(), original.substring(original.lastIndexOf(java.io.File.separator) + 1));
+					runDiff(fi1.getAbsolutePath(), fi2.getAbsolutePath());
 					return false;
 				}
 			}
diff --git a/bindings/java/test/org/sleuthkit/datamodel/DiffUtil.java b/bindings/java/test/org/sleuthkit/datamodel/DiffUtil.java
deleted file mode 100644
index a6b648bdf..000000000
--- a/bindings/java/test/org/sleuthkit/datamodel/DiffUtil.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Sleuth Kit Data Model
- *
- * Copyright 2011 Basis Technology Corp.
- * Contact: carrier <at> sleuthkit <dot> org
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.sleuthkit.datamodel;
-
-import difflib.Delta;
-import difflib.DiffUtils;
-import difflib.Patch;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * This class gets the Diff of two files.
- */
-public class DiffUtil {
-
-	/**
-	 * converts a file to a series of lines
-	 *
-	 * @param filename the name of the file
-	 * @return
-	 */
-	private static List<String> fileToLines(String filename) {
-		List<String> lines = new LinkedList<String>();
-		String line;
-		try {
-			BufferedReader in = new BufferedReader(new FileReader(new java.io.File(filename).getAbsolutePath()));
-			while ((line = in.readLine()) != null) {
-				lines.add(line);
-			}
-		} catch (IOException ex) {
-			Logger.getLogger(DiffUtil.class.getName()).log(Level.SEVERE, "Couldn't read file", ex);
-			throw new RuntimeException(ex);
-		}
-		return lines;
-	}
-
-	/**
-	 * Returns the diff between the two given files
-	 *
-	 * @param pathOriginal The path to the original file
-	 * @param pathRevised The path to the revised (new) file
-	 * @return A representation of the diff
-	 */
-	public static void getDiff(String pathOriginal, String pathRevised, String title) {
-		List<String> originalLines, revisedLines;
-		originalLines = fileToLines(pathOriginal);
-		revisedLines = fileToLines(pathRevised);
-		java.io.File outp = new java.io.File(DataModelTestSuite.getRsltPath() + java.io.File.separator + title.replace(".txt", "_Diff.txt"));
-		// Compute diff. Get the Patch object. Patch is the container for computed deltas.
-		Patch patch = DiffUtils.diff(originalLines, revisedLines);
-		StringBuilder diff = new StringBuilder();
-
-		for (Delta delta : patch.getDeltas()) {
-			diff.append(delta.toString());
-			diff.append("\n");
-		}
-		try {
-			FileWriter out = new FileWriter(outp);
-			out.append(diff);
-			out.flush();
-		} catch (IOException ex) {
-			Logger.getLogger(DiffUtil.class.getName()).log(Level.SEVERE, "Couldn't write Diff to file", ex);
-		}
-	}
-}
\ No newline at end of file
-- 
GitLab