Commit c251827b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Logcat: catch FileNotFoundException too

parent 6cd6fa17
...@@ -22,6 +22,7 @@ package org.videolan.vlc.util; ...@@ -22,6 +22,7 @@ package org.videolan.vlc.util;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
...@@ -40,15 +41,22 @@ public class Logcat { ...@@ -40,15 +41,22 @@ public class Logcat {
String[] args = { "logcat", "-v", "time", "-d" }; String[] args = { "logcat", "-v", "time", "-d" };
Process process = Runtime.getRuntime().exec(args); Process process = Runtime.getRuntime().exec(args);
InputStreamReader input = new InputStreamReader(
process.getInputStream()); InputStreamReader input = new InputStreamReader(process.getInputStream());
OutputStreamWriter output = new OutputStreamWriter(
new FileOutputStream(filename)); FileOutputStream fileStream;
try {
fileStream = new FileOutputStream(filename);
} catch( FileNotFoundException e) {
return;
}
OutputStreamWriter output = new OutputStreamWriter(fileStream);
BufferedReader br = new BufferedReader(input); BufferedReader br = new BufferedReader(input);
BufferedWriter bw = new BufferedWriter(output); BufferedWriter bw = new BufferedWriter(output);
String line;
try { try {
String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
bw.write(line); bw.write(line);
bw.newLine(); bw.newLine();
......
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