Merge "Fix more things that CloseGuard found."

This commit is contained in:
Brad Fitzpatrick
2010-11-16 13:50:07 -08:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 4 deletions

View File

@@ -7327,16 +7327,22 @@ class PackageManagerService extends IPackageManager.Stub {
pw.println(" ");
pw.println("Package warning messages:");
File fname = getSettingsProblemFile();
FileInputStream in;
FileInputStream in = null;
try {
in = new FileInputStream(fname);
int avail = in.available();
byte[] data = new byte[avail];
in.read(data);
pw.print(new String(data));
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
}
}
}

View File

@@ -799,8 +799,9 @@ public class ProcessStats {
}
private String readFile(String file, char endChar) {
FileInputStream is = null;
try {
FileInputStream is = new FileInputStream(file);
is = new FileInputStream(file);
int len = is.read(mBuffer);
is.close();
@@ -815,6 +816,13 @@ public class ProcessStats {
}
} catch (java.io.FileNotFoundException e) {
} catch (java.io.IOException e) {
} finally {
if (is != null) {
try {
is.close();
} catch (java.io.IOException e) {
}
}
}
return null;
}
@@ -841,4 +849,3 @@ public class ProcessStats {
}
}
}