From bd5a5a6fc6eb4c8d7ff7709abc14800adfb95b84 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 4 Nov 2015 05:41:50 +0000 Subject: [PATCH] * Display BindingException class error messages as "info" type messages instead of "warning" type, so users will understand that these messages are to be expected for some formats in some cases, and can be safely ignored --- source/net/filebot/format/BindingException.java | 2 +- source/net/filebot/format/MediaBindingBean.java | 4 ++-- source/net/filebot/resources/status.info.png | Bin 0 -> 1231 bytes source/net/filebot/ui/rename/FormatDialog.java | 12 ++++++++---- 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100755 source/net/filebot/resources/status.info.png diff --git a/source/net/filebot/format/BindingException.java b/source/net/filebot/format/BindingException.java index ff2c1803..11a6f89e 100644 --- a/source/net/filebot/format/BindingException.java +++ b/source/net/filebot/format/BindingException.java @@ -11,7 +11,7 @@ public class BindingException extends RuntimeException { } public BindingException(String binding, String innerMessage, Throwable cause) { - this(String.format("BindingException: \"%s\": %s", binding, innerMessage), cause); + this(String.format("Binding \"%s\": %s", binding, innerMessage), cause); } } diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 35618e7f..4fc4be84 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -862,10 +862,10 @@ public class MediaBindingBean { return mediaFile; } - private void checkMediaFile() throws RuntimeException { + private void checkMediaFile() { // make sure file is not null, and that it is an existing file if (mediaFile == null) { - throw new RuntimeException("Path to media file not set. Click (x)= and select a sample file."); + throw new IllegalStateException("Path to media file not set. Click (x)= and select a sample file."); } } diff --git a/source/net/filebot/resources/status.info.png b/source/net/filebot/resources/status.info.png new file mode 100755 index 0000000000000000000000000000000000000000..e7646b14517cdbe2d5c7aa2a6e2b1c9c172ecec8 GIT binary patch literal 1231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)o?` zlaex{o_8lltG>T{k9`*#|JU-;vXreF;Wg)1R?TK+{~T;Q z`Me(U$Gt31f|rZwMeID+y*yrKBm1x28@IL^3LN89z5e+3)!iE(hw15`liUAcy@&UM z1K!2&ZEpPk@TYpc%+ZyuJHB@8$z^voO zUrq@B+$8AdN&8~&U zwq0pq2|}y3axDFRX`_)%@kjQ$nbmR)QNa^ceDB<4%iHR;@{zM~lZQuYUR=?U%lXs8 z&E9?Eoa>m*y`qnA%B2u3QHE*TYdwTIoH&F#lslwSH~%~8_sTJ;PMPnQ&o&1QrZ!J_X~@Z<=W;N&K}7Ya$=0Br4M7{W73%eF|8Y*;{lK~AZI?aEw7L$IqI2di{284n>LCySkS8DYUEhmpXsR z_?7*PFXvBdPxxe&zI~6bpZA+(`{-Y)Q_sHAGv`)nYpj+qd(^{N;;t6dX76NgBddS@ z|Bw3HH^Pcu^e$pN^R@Nu@5FzM(>ZkF4iv5Y3rxhSC9V-A$wjG&C8@e8K!U-@z`#=1 z&`{UVG{n%{%D~9V*hJR=$S~OUyiW+G0i@Cjq6?_O&_LI~NY}_9#K_pn$jr(JszL8? zz%>*Nx%nxXX_Zh7KpPB03@m}FtxU`yHuUqII|tN|4sw!DW^!s?aVkSbNlAf~zCPHl z%(B$v{M_99ykfolqICTnh>~Lcq)Of5M15mD1AT@3A_Zb}__zo7=o{%7>PPq6B*WYY zaUN1A7#QmsT80=JSeY7GnHuUEm;pnfKI1Q_#E=BJF*rZ1q&%@Gm7%=6TrV>(yEr+q zAQj}a+3#$mfQp16ib{);QyKg#D$`T*6g-oGu74x3?gda<9U&bb8sr1>D#);Wuxi~* YkZQ1B-FVdQ&MBb@0ER601^@s6 literal 0 HcmV?d00001 diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index cab87065..bcbb6dbf 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -63,7 +63,6 @@ import javax.swing.text.BadLocationException; import net.filebot.ResourceManager; import net.filebot.Settings; import net.filebot.UserFiles; -import net.filebot.WebServices; import net.filebot.format.BindingException; import net.filebot.format.ExpressionFormat; import net.filebot.format.MediaBindingBean; @@ -544,9 +543,14 @@ public class FormatDialog extends JDialog { } catch (CancellationException e) { // ignore, cancelled tasks are obsolete anyway } catch (Exception e) { - BindingException bindingException = findCause(e, BindingException.class); - status.setText(bindingException != null ? getMessage(bindingException) : String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage())); - status.setIcon(ResourceManager.getIcon("status.warning")); + BindingException issue = findCause(e, BindingException.class); + if (issue != null) { + status.setText(getMessage(issue)); + status.setIcon(ResourceManager.getIcon("status.info")); + } else { + status.setText(String.format("%s: %s", e.getClass().getSimpleName(), e.getMessage())); + status.setIcon(ResourceManager.getIcon("status.warning")); + } status.setVisible(true); } finally { preview.setVisible(preview.getText().trim().length() > 0);