From 514da0237f6239322193d5d4b11b58fe4095da2b Mon Sep 17 00:00:00 2001
From: SHaselbauer <sarah.haselbauer@akquinet.de>
Date: Wed, 23 Jan 2013 10:27:42 -0500
Subject: [PATCH] seleniumFixV2: connected thread pool creation to condition web.allowLuceneIndexing (otherwise thread pool will be kept open for more than a minute, what hinders the start of another gitblit instance in the same jvm during selenium test case execution), fixed naming of xpath variables, added missing property to gitblit.properties and test-ui-gitblit.properties, changed naming of methods (according to decision that owners is a much shorter word than repository administrator and that owners is fits better if you think of collective responsibilities and collective ownership)

---
 src/com/gitblit/utils/FileUtils.java |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/com/gitblit/utils/FileUtils.java b/src/com/gitblit/utils/FileUtils.java
index 0b8aeb4..a21b512 100644
--- a/src/com/gitblit/utils/FileUtils.java
+++ b/src/com/gitblit/utils/FileUtils.java
@@ -176,19 +176,17 @@
 	public static long folderSize(File directory) {
 		if (directory == null || !directory.exists()) {
 			return -1;
-		}
-		if (directory.isFile()) {
-			return directory.length();
-		}
-		long length = 0;
-		for (File file : directory.listFiles()) {
-			if (file.isFile()) {
-				length += file.length();
-			} else {
+		}		
+		if (directory.isDirectory()) {
+			long length = 0;
+			for (File file : directory.listFiles()) {
 				length += folderSize(file);
 			}
+			return length;
+		} else if (directory.isFile()) {
+			return directory.length();
 		}
-		return length;
+		return 0;
 	}
 
 	/**
@@ -276,4 +274,19 @@
 			return path.getAbsoluteFile();
 		}
 	}
+
+	public static File resolveParameter(String parameter, File aFolder, String path) {
+		if (aFolder == null) {
+			// strip any parameter reference		
+			path = path.replace(parameter, "").trim();
+			if (path.length() > 0 && path.charAt(0) == '/') {
+				// strip leading /
+				path = path.substring(1);
+			}
+		} else if (path.contains(parameter)) {
+			// replace parameter with path
+			path = path.replace(parameter, aFolder.getAbsolutePath());
+		}
+		return new File(path);
+	}
 }

--
Gitblit v1.9.1