modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java | 12 +++++-----
1 file changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 213f42ae56da1215cf57bc56bf05dfcbe28e11c7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 26 16:51:27 2014 -0500
[915532] [apache] Unable to discover Apache httpd on Windows if Include...
Revision of fix in commit 3d9cdf6d9d7eae5643ff270816b236ba0dc74f9b after review.
(revised fix)
Apply fix based on Larry O'Leary's suggestion in the BZ. Localize the
change to a windows-only block in Glob.rootPortion such that all callers
benefit and non-windows is unaffected.
diff --git a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
index 96faf5c..993acd8 100644
--- a/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
+++ b/modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
@@ -24,7 +24,6 @@
package org.rhq.augeas.util;
import java.io.File;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -216,12 +215,13 @@ public class Glob {
}
public static String rootPortion(String path) {
- // On Windows, make sure we have the correct case and slash direction for
comparison.
+ // On Windows, make sure we have the correct drive letter format and slash
direction for comparison.
if (File.separator.equals("\\")) {
try {
- path = new File(path).getCanonicalPath();
- } catch (IOException e) {
- // should never happen but just leave path as-is
+ File f = new File(path);
+ path = f.isAbsolute() ? f.getCanonicalPath() : f.getPath();
+ } catch (Exception e) {
+ // should not happen but just leave path as-is
}
}
File[] roots = File.listRoots();
@@ -233,7 +233,7 @@ public class Glob {
}
} else {
log.warn("Could not determine file system roots. This is
strange.");
- }
+ }
return "";
}
Show replies by date