modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
| 16 ++------
modules/plugins/augeas/src/main/java/org/rhq/augeas/util/Glob.java
| 19 +++++++---
2 files changed, 18 insertions(+), 17 deletions(-)
New commits:
commit 8f98335a235c3a8f819d1a3d3a4d72d9ade052a3
Merge: 56081bb... 1fa4fa8...
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Tue Jul 27 23:34:05 2010 +0200
Merge branch 'release-3.0.0' of
ssh://git.fedorahosted.org/git/rhq/rhq into
release-3.0.0
commit 56081bbf57ddb82a7796ac33f5db80a4ed014d20
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Tue Jul 27 23:30:01 2010 +0200
BZ-618230 - absolute path in apache configuration file, breaks discovery.
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
index e54b642..f33f8fd 100644
---
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/parser/ApacheParserImpl.java
@@ -42,17 +42,9 @@ public class ApacheParserImpl implements ApacheParser{
}
private List<File> getIncludeFiles(String foundInclude) {
- List<File> ret = new ArrayList<File>();
- File serverRootFile = new File(serverRootPath);
- File check = new File(foundInclude);
- if (check.isAbsolute()) {
- ret.add(check);
- } else {
- for (File f : Glob.match(serverRootFile, foundInclude)) {
- ret.add(f);
- }
- }
-
- return ret;
+ File check = new File(foundInclude);
+ File root = new File(check.isAbsolute() ? Glob.rootPortion(foundInclude) :
serverRootPath);
+
+ return Glob.match(root, foundInclude);
}
}
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 94aea0a..fddf06e 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
@@ -28,6 +28,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* A helper class for easy work with glob patterns.
@@ -36,6 +38,8 @@ import java.util.List;
*/
public class Glob {
+ private static final Log log = LogFactory.getLog(Glob.class);
+
private Glob() {
}
@@ -169,12 +173,17 @@ public class Glob {
}
}
- private static String rootPortion(String path) {
- for (File root : File.listRoots()) {
- if (path.startsWith(root.getPath())) {
- return root.getPath();
+ public static String rootPortion(String path) {
+ File[] roots = File.listRoots();
+ if (roots != null) {
+ for (File root : roots) {
+ if (path.startsWith(root.getPath())) {
+ return root.getPath();
+ }
}
- }
+ } else {
+ log.warn("Could not determine file system roots. This is
strange.");
+ }
return "";
}