modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java |
16 +++++++---
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 30dadb8f106ceb14560767bd83f4add50396c547
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Feb 27 12:59:38 2012 -0500
Add null checks on several finally close() methods
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 e381593..63d5a6c 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
@@ -253,7 +253,9 @@ public class DriftDetector implements Runnable {
currentFullSnapshotReader =
changeSetMgr.getChangeSetReader(currentFullSnapshot);
newVersion = currentFullSnapshotReader.getHeaders().getVersion()
+ 1;
} finally {
- currentFullSnapshotReader.close();
+ if (null != currentFullSnapshotReader) {
+ currentFullSnapshotReader.close();
+ }
}
} else {
newVersion = snapshotReader.getHeaders().getVersion() + 1;
@@ -264,7 +266,9 @@ public class DriftDetector implements Runnable {
changedEntries, removedEntries, changedPinnedEntries);
} finally {
- snapshotReader.close();
+ if (null != snapshotReader) {
+ snapshotReader.close();
+ }
}
// if necessary, re-write the pinned snapshot file because we've updated
timestamp/filesize info, which
@@ -564,7 +568,9 @@ public class DriftDetector implements Runnable {
}
return newSnapshot;
} finally {
- newSnapshotWriter.close();
+ if (null != newSnapshotWriter) {
+ newSnapshotWriter.close();
+ }
}
}
@@ -584,7 +590,9 @@ public class DriftDetector implements Runnable {
return pinnedSnapshot;
} finally {
- newSnapshotWriter.close();
+ if (null != newSnapshotWriter) {
+ newSnapshotWriter.close();
+ }
}
}
Show replies by date