diff src/org/tmatesoft/hg/util/RegularFileStats.java @ 476:c02b5710d9ac

Defect: only first file in directory got flags initialized
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 12 Jul 2012 18:07:12 +0200
parents 909306e412e2
children 661e77dc88ba
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/util/RegularFileStats.java	Thu Jul 12 16:57:40 2012 +0200
+++ b/src/org/tmatesoft/hg/util/RegularFileStats.java	Thu Jul 12 18:07:12 2012 +0200
@@ -108,10 +108,10 @@
 		}
 		final String dirName = f.getParentFile().getAbsolutePath();
 		final String fileName = f.getName();
-		Map<String, String> links = dir2links.get(dirName);
-		Set<String> execs = dir2execs.get(dirName);
-		if (links == null || execs == null) {
-			try {
+		try {
+			Map<String, String> links = dir2links.get(dirName);
+			Set<String> execs = dir2execs.get(dirName);
+			if (links == null || execs == null) {
 				ArrayList<String> cmd = new ArrayList<String>(command);
 				cmd.add(dirName);
 				CharSequence result = execHelper.exec(cmd);
@@ -134,23 +134,23 @@
 				}
 				dir2links.put(dirName, links);
 				dir2execs.put(dirName, execs);
-				isExec = execs.contains(fileName);
-				isSymlink = links.containsKey(fileName);
-				if (isSymlink) {
-					symlinkValue = links.get(fileName);
-				} else {
-					symlinkValue = null;
-				}
-			} catch (InterruptedException ex) {
-				sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f));
-				// try again? ensure not too long? stop right away?
-				// IGNORE, keep isExec and isSymlink false
-			} catch (IOException ex) {
-				sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f));
-				// IGNORE, keep isExec and isSymlink false
 			}
+			isExec = execs.contains(fileName);
+			isSymlink = links.containsKey(fileName);
+			if (isSymlink) {
+				symlinkValue = links.get(fileName);
+			} else {
+				symlinkValue = null;
+			}
+		} catch (InterruptedException ex) {
+			sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f));
+			// try again? ensure not too long? stop right away?
+			// IGNORE, keep isExec and isSymlink false
+		} catch (IOException ex) {
+			sessionContext.getLog().dump(getClass(), Warn, ex, String.format("Failed to detect flags for %s", f));
+			// IGNORE, keep isExec and isSymlink false
 		}
-	}
+}
 
 	public boolean isExecutable() {
 		return isExec;