From 2264761bf5de40903684068763c39f04040b4ef1 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 9 Jul 2016 21:17:59 +0800 Subject: [PATCH] Display error message in GUI when subtitles cannot be written to disk (e.g. permission issues) --- .../net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java index ce9eabfe..5c09957b 100644 --- a/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java +++ b/source/net/filebot/ui/subtitle/SubtitleAutoMatchDialog.java @@ -16,6 +16,7 @@ import java.awt.event.ActionEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; +import java.io.IOException; import java.net.URI; import java.util.AbstractList; import java.util.ArrayList; @@ -445,7 +446,7 @@ class SubtitleAutoMatchDialog extends JDialog { setIcon(subtitleBean.getIcon()); setToolTipText(null); } else { - setText(String.format("%s (%s)", subtitleBean.getText(), subtitleBean.getError().getMessage())); + setText(String.format("%s (%s)", subtitleBean.getError().getMessage(), subtitleBean.getText())); setIcon(ResourceManager.getIcon("status.warning")); setToolTipText(subtitleBean.getError().toString()); } @@ -832,6 +833,10 @@ class SubtitleAutoMatchDialog extends JDialog { return destination; } catch (Exception e) { + // display error message in GUI + descriptor.error = new IOException("Failed to write file: " + e.getMessage()); + + // print to error log debug.log(Level.WARNING, e.getMessage(), e); }