From d3df8cd4e4bf36289ebdafd66146889d86cf5ed8 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 3 Aug 2016 01:51:53 +0800 Subject: [PATCH] Fix regression issue. https://www.filebot.net/forums/viewtopic.php?f=6&t=4023 --- source/net/filebot/cli/CmdlineOperations.java | 5 ++--- source/net/filebot/media/MediaDetection.java | 5 ++--- source/net/filebot/ui/rename/MovieMatcher.java | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/net/filebot/cli/CmdlineOperations.java b/source/net/filebot/cli/CmdlineOperations.java index 2b9b4496..2b71b599 100644 --- a/source/net/filebot/cli/CmdlineOperations.java +++ b/source/net/filebot/cli/CmdlineOperations.java @@ -32,7 +32,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; -import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; import java.util.SortedSet; @@ -384,8 +383,8 @@ public class CmdlineOperations implements CmdlineInterface { } } } - } catch (NoSuchElementException e) { - log.warning("Failed to grep IMDbID: " + nfo.getName()); + } catch (Exception e) { + log.log(Level.WARNING, "Failed to grep IMDbID: " + nfo.getName(), e); } } } else { diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index c6f9007e..b921d979 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -1216,9 +1216,8 @@ public class MediaDetection { } public static Movie grepMovie(File nfo, MovieIdentificationService resolver, Locale locale) throws Exception { - String text = readTextFile(nfo); - int imdbId = grepImdbId(text).get(0); - return resolver.getMovieDescriptor(new Movie(imdbId), locale); + List imdbId = grepImdbId(readTextFile(nfo)); + return imdbId.isEmpty() ? null : resolver.getMovieDescriptor(new Movie(imdbId.get(0)), locale); } public static SeriesInfo grepSeries(File nfo, Locale locale) throws Exception { diff --git a/source/net/filebot/ui/rename/MovieMatcher.java b/source/net/filebot/ui/rename/MovieMatcher.java index ac02510c..bd6dee84 100644 --- a/source/net/filebot/ui/rename/MovieMatcher.java +++ b/source/net/filebot/ui/rename/MovieMatcher.java @@ -142,8 +142,8 @@ class MovieMatcher implements AutoCompleteMatcher { } } } - } catch (NoSuchElementException e) { - debug.log(Level.WARNING, "Failed to grep IMDbID: " + nfo.getName()); + } catch (Exception e) { + debug.log(Level.WARNING, "Failed to grep IMDbID: " + nfo.getName(), e); } }