Eclipse (Juno) では、次の警告が表示されます。
潜在的なリソース リーク: 'os' が閉じられていない可能性があります
try
このコードの本文の最初の行:
static void saveDetails(byte[] detailsData) {
OutputStream os = null;
try {
os = sContext.openFileOutput(DETAILS_FILE_NAME, Context.MODE_PRIVATE);
os.write(detailsData);
} catch (IOException e) {
Log.w(LOG_TAG, "Unable to save details", e);
} finally {
if (os != null) {
try {
os.close();
} catch (IOException ignored) {
}
}
}
}
メソッドopenFileOutput
は をスローするように宣言されていFileNotFoundException
ます。
これは偽陽性ですか?かなりバニラの実行パス分析のようです。