From e3fde5f139fc829353a371112cdc8394f013889a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 26 Jul 2012 08:40:20 +0000 Subject: [PATCH] * improved error messages --- .../sourceforge/filebot/ui/rename/RenameAction.java | 11 ++++++----- .../sourceforge/filebot/ui/rename/RenamePanel.java | 5 ++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/net/sourceforge/filebot/ui/rename/RenameAction.java b/source/net/sourceforge/filebot/ui/rename/RenameAction.java index d24cf819..c9c77d5c 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenameAction.java +++ b/source/net/sourceforge/filebot/ui/rename/RenameAction.java @@ -5,6 +5,7 @@ package net.sourceforge.filebot.ui.rename; import static java.util.Collections.*; import static net.sourceforge.filebot.Settings.*; import static net.sourceforge.filebot.ui.NotificationLogging.*; +import static net.sourceforge.tuned.ExceptionUtilities.*; import static net.sourceforge.tuned.ui.TunedUtilities.*; import java.awt.Cursor; @@ -27,7 +28,6 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.logging.Level; -import java.util.logging.Logger; import javax.swing.AbstractAction; import javax.swing.Icon; @@ -271,12 +271,13 @@ class RenameAction extends AbstractAction { protected void done() { try { postprocess.acquire(); - } catch (InterruptedException e) { - Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e); + this.get(); // grab exception if any + } catch (Exception e) { + UILogger.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), e); } // collect renamed types - final List types = new ArrayList(); + final List> types = new ArrayList>(); // remove renamed matches for (File source : renameLog.keySet()) { @@ -293,7 +294,7 @@ class RenameAction extends AbstractAction { HistorySpooler.getInstance().append(renameLog.entrySet()); // count global statistics - for (Class it : new HashSet(types)) { + for (Class it : new HashSet>(types)) { Analytics.trackEvent("GUI", "Rename", it.getSimpleName(), frequency(types, it)); } } diff --git a/source/net/sourceforge/filebot/ui/rename/RenamePanel.java b/source/net/sourceforge/filebot/ui/rename/RenamePanel.java index 05b9623e..013244b8 100644 --- a/source/net/sourceforge/filebot/ui/rename/RenamePanel.java +++ b/source/net/sourceforge/filebot/ui/rename/RenamePanel.java @@ -5,6 +5,7 @@ package net.sourceforge.filebot.ui.rename; import static javax.swing.JOptionPane.*; import static javax.swing.SwingUtilities.*; import static net.sourceforge.filebot.ui.NotificationLogging.*; +import static net.sourceforge.tuned.ExceptionUtilities.*; import static net.sourceforge.tuned.ui.LoadingOverlayPane.*; import static net.sourceforge.tuned.ui.TunedUtilities.*; @@ -56,7 +57,6 @@ import net.sourceforge.filebot.web.Movie; import net.sourceforge.filebot.web.MovieFormat; import net.sourceforge.filebot.web.MovieIdentificationService; import net.sourceforge.filebot.web.SortOrder; -import net.sourceforge.tuned.ExceptionUtilities; import net.sourceforge.tuned.PreferencesMap.PreferencesEntry; import net.sourceforge.tuned.ui.ActionPopup; import net.sourceforge.tuned.ui.LoadingOverlayPane; @@ -301,7 +301,6 @@ public class RenamePanel extends JComponent { return actionPopup; } - protected final Action openHistoryAction = new AbstractAction("Open History", ResourceManager.getIcon("action.report")) { @Override @@ -450,7 +449,7 @@ public class RenamePanel extends JComponent { // add remaining file entries renameModel.files().addAll(remainingFiles); } catch (Exception e) { - UILogger.log(Level.WARNING, ExceptionUtilities.getRootCauseMessage(e), e); + UILogger.log(Level.WARNING, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), e); } finally { // auto-match finished namesList.firePropertyChange(LOADING_PROPERTY, true, false);