modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java |
2
modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java |
22 +++++-----
2 files changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 7eed6555906199687c5f9f5d6c8cf50c15970d0d
Merge: 096cb99 b9ef6c8
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Sat Nov 26 11:31:39 2011 +0100
Merge branch 'master' into feature/rest
commit b9ef6c8f5c67d257dc63ea56ef9e56c39bb22b47
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Nov 25 19:53:54 2011 +0100
BZ 757178 If we can't read the file return to prevent an Exception later.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
index e0f7509..3f32f1f 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
@@ -222,8 +222,8 @@ public class DriftDetector implements Runnable {
if (!file.canRead()) {
if (log.isDebugEnabled()) {
log.debug("Skipping " + file.getPath() + "
since it is not readable.");
- return;
}
+ return;
}
if (log.isInfoEnabled()) {
commit ee3319453f65791975cdd753a5d9f1757ae483cc
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Nov 25 18:19:30 2011 +0100
BZ 757175 Prevent a NPE by missing directory listing rights.
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
index 7cfac87..c4ac737 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/file/FileUtil.java
@@ -68,9 +68,9 @@ public class FileUtil {
/**
* Given a directory, this will recursively purge all child directories and files.
* If dir is actually a normal file, it will be deleted but only if deleteIt is
true.
- *
+ *
* If deleteIt is true, the directory itself will be deleted, otherwise it will
remain (albeit empty).
- *
+ *
* @param dir the directory to purge (if <code>null</code>, this method
does nothing and returns normally)
* @param deleteIt if <code>true</code> delete the directory itself,
otherwise leave it but purge its children
*/
@@ -297,7 +297,7 @@ public class FileUtil {
/**
* Strips the drive letter from the given Windows path. The drive letter is returned
* or <code>null</code> is returned if there was no drive letter in the
path.
- *
+ *
* @param path the path string that will be altered to have its drive letter
stripped.
* @return if there was a drive letter, it will be returned. If no drive letter was
in path, null is returned
*/
@@ -326,7 +326,7 @@ public class FileUtil {
* Return just the filename portion (the portion right of the last path separator
string)
* @param path
* @param separator
- * @return null if path is null, otherwise the trimmed filename
+ * @return null if path is null, otherwise the trimmed filename
*/
public static String getFileName(String path, String separator) {
if (null == path) {
@@ -353,11 +353,13 @@ public class FileUtil {
while (!directories.isEmpty()) {
File dir = directories.pop();
- for (File file : dir.listFiles()) {
- if (file.isDirectory()) {
- directories.push(file);
- } else {
- visitor.visit(file);
+ if (dir.listFiles()!=null) {
+ for (File file : dir.listFiles()) {
+ if (file.isDirectory()) {
+ directories.push(file);
+ } else {
+ visitor.visit(file);
+ }
}
}
}
@@ -444,7 +446,7 @@ public class FileUtil {
regex.append('.');
} else if (c == '*') {
- // ? match zero or more characters
+ // ? match zero or more characters
if (i + 1 < pattern.length()) {
char c2 = pattern.charAt(i + 1);
if (c2 == '*') {
Show replies by date