diff --git a/app/src/main/java/com/simplemobiletools/draw/Svg.java b/app/src/main/java/com/simplemobiletools/draw/Svg.java index 7c20407..31a97be 100644 --- a/app/src/main/java/com/simplemobiletools/draw/Svg.java +++ b/app/src/main/java/com/simplemobiletools/draw/Svg.java @@ -12,17 +12,12 @@ import java.util.Map; public class Svg { - public static boolean saveSvg(File output, MyCanvas canvas) { - try { - FileOutputStream out = new FileOutputStream(output); - BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); - writeSvg(writer, canvas.getPaths(), canvas.getWidth(), canvas.getHeight()); - writer.close(); - return true; - } catch (IOException e) { - e.printStackTrace(); - return false; - } + public static void saveSvg(File output, MyCanvas canvas) + throws IOException { + FileOutputStream out = new FileOutputStream(output); + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); + writeSvg(writer, canvas.getPaths(), canvas.getWidth(), canvas.getHeight()); + writer.close(); } private static void writeSvg(Writer writer, diff --git a/app/src/main/java/com/simplemobiletools/draw/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/draw/activities/MainActivity.java index 872a4ec..74b2cfb 100644 --- a/app/src/main/java/com/simplemobiletools/draw/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/draw/activities/MainActivity.java @@ -218,7 +218,7 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange MediaScannerConnection.scanFile(getApplicationContext(), new String[]{file.getAbsolutePath()}, null, null); } catch (Exception e) { - Log.e(TAG, "MainActivity SaveFile " + e.getMessage()); + Log.e(TAG, "MainActivity SaveFile (.png) " + e.getMessage()); return false; } finally { try { @@ -226,14 +226,16 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange out.close(); } } catch (IOException e) { - Log.e(TAG, "MainActivity SaveFile 2 " + e.getMessage()); + Log.e(TAG, "MainActivity SaveFile (.png) 2 " + e.getMessage()); } } break; case ".svg": - if (!Svg.saveSvg(file, mMyCanvas)) { - Log.e(TAG, "MainActivity SaveFile failed."); + try { + Svg.saveSvg(file, mMyCanvas); + } catch (IOException e) { + Log.e(TAG, "MainActivity SaveFile (.svg) " + e.getMessage()); return false; } break;