Commit 6cd6fa17 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

AudioService: do not leak resources in exceptions

And catch all exceptions
parent f1069517
......@@ -1382,8 +1382,8 @@ public class AudioService extends Service {
return;
String line;
FileInputStream input;
BufferedReader br;
FileInputStream input = null;
BufferedReader br = null;
int rowCount = 0;
int position = 0;
......@@ -1396,7 +1396,7 @@ public class AudioService extends Service {
br = new BufferedReader(new InputStreamReader(input));
currentMedia = br.readLine();
mShuffling = "1".equals(br.readLine());
br.close();
br.close(); br = null;
input.close();
// read MediaList
......@@ -1408,16 +1408,21 @@ public class AudioService extends Service {
position = rowCount;
rowCount++;
}
br.close();
input.close();
// load playlist
mInterface.load(mediaPathList, position, false);
} catch (IOException e) {
e.printStackTrace();
} catch (RemoteException e) {
} catch (Exception e) {
e.printStackTrace();
}
finally {
try {
if (br!= null) br.close();
if (input != null) input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private synchronized void saveCurrentMedia() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment