Bug 1251213 - release resources from fis. r=sebastian

MozReview-Commit-ID: 9RTJprP6rh2
This commit is contained in:
Andi-Bogdan Postelnicu 2016-03-02 11:02:44 +02:00
parent a1c2a24964
commit e234d8fd64

View File

@ -2853,19 +2853,19 @@ private void CancelNotification()
String sPort = "";
int nEnd = 0;
int nStart = 0;
FileInputStream fis = null;
if ((sFileName == null) || (sFileName.length() == 0))
return(sRet);
Context ctx = contextWrapper.getApplicationContext();
try {
FileInputStream fis = ctx.openFileInput(sFileName);
fis = ctx.openFileInput(sFileName);
int nBytes = fis.available();
if (nBytes > 0)
{
byte [] buffer = new byte [nBytes + 1];
int nRead = fis.read(buffer, 0, nBytes);
fis.close();
ctx.deleteFile(sFileName);
if (nRead > 0)
{
@ -2898,6 +2898,19 @@ private void CancelNotification()
{
e.printStackTrace();
}
finally
{
if (fis != null)
{
try {
fis.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
return(sRet);
}