modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java | 14 ++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
New commits:
commit e66e440677ca2059a8c44ee0aef8b5826d6228d6
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 26 17:12:23 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.
Conflicts:
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
Cherry-Pick of Master 213f42ae56da1215cf57bc56bf05dfcbe28e11c7
Reviewed-by: Larry O'Leary <loleary(a)redhat.com>
Signed-off-by: Jay Shaughnessy <jshaughn(a)redhat.com>
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 c61f932..588ab7f 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
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -214,6 +215,15 @@ public class Glob {
}
public static String rootPortion(String path) {
+ // On Windows, make sure we have the correct drive letter format and slash
direction for comparison.
+ if (File.separator.equals("\\")) {
+ try {
+ 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();
if (roots != null) {
for (File root : roots) {
@@ -223,8 +233,8 @@ public class Glob {
}
} else {
log.warn("Could not determine file system roots. This is
strange.");
- }
-
+ }
+
return "";
}
}
Show replies by date