Fix an NPE issue if state file is empty. (FELIX-902)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@738920 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
index 8f8551e..cc6bc9c 100644
--- a/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
+++ b/framework/src/main/java/org/apache/felix/framework/cache/BundleArchive.java
@@ -309,11 +309,11 @@
.getFileInputStream(stateFile);
br = new BufferedReader(new InputStreamReader(is));
String s = br.readLine();
- if (s.equals(ACTIVE_STATE))
+ if ((s != null) && s.equals(ACTIVE_STATE))
{
m_persistentState = Bundle.ACTIVE;
}
- else if (s.equals(UNINSTALLED_STATE))
+ else if ((s != null) && s.equals(UNINSTALLED_STATE))
{
m_persistentState = Bundle.UNINSTALLED;
}
@@ -343,7 +343,7 @@
{
// Write the bundle state.
OutputStream os = null;
- BufferedWriter bw= null;
+ BufferedWriter bw = null;
try
{
os = BundleCache.getSecureAction()