Unify gui/console logging

This commit is contained in:
Reinhard Pointner 2016-03-09 20:36:28 +00:00
parent 1ab9d36938
commit 78c3b6917d
55 changed files with 164 additions and 187 deletions

View File

@ -159,6 +159,7 @@ public class Cache {
return (V) super.computeIf(key, condition, compute);
}
@Override
public V computeIfAbsent(Object key, Compute<?> compute) throws Exception {
return (V) super.computeIfAbsent(key, compute);
}

View File

@ -1,6 +1,7 @@
package net.filebot;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import java.io.File;
import java.io.InputStream;
@ -13,7 +14,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
@ -200,7 +200,7 @@ public class History {
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(history, output);
} catch (Exception e) {
Logger.getLogger(History.class.getName()).log(Level.SEVERE, "Failed to write history", e);
debug.log(Level.SEVERE, "Failed to write history", e);
}
}
@ -209,7 +209,7 @@ public class History {
Unmarshaller unmarshaller = JAXBContext.newInstance(History.class).createUnmarshaller();
return ((History) unmarshaller.unmarshal(stream));
} catch (Exception e) {
Logger.getLogger(History.class.getName()).log(Level.SEVERE, "Failed to read history", e);
debug.log(Level.SEVERE, "Failed to read history", e);
// fail-safe => default to empty history
return new History();

View File

@ -1,5 +1,6 @@
package net.filebot;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import java.io.File;
@ -13,7 +14,6 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.History.Element;
@ -75,7 +75,7 @@ public final class HistorySpooler {
channel.position(0);
history = History.importHistory(new CloseShieldInputStream(Channels.newInputStream(channel))); // keep JAXB from closing the stream
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Failed to load rename history.", e);
debug.log(Level.SEVERE, "Failed to load rename history", e);
}
}
@ -90,7 +90,7 @@ public final class HistorySpooler {
}
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "Failed to write rename history.", e);
debug.log(Level.SEVERE, "Failed to write rename history", e);
}
}

View File

@ -31,7 +31,6 @@ import java.security.ProtectionDomain;
import java.util.Map;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDialog;
import javax.swing.JFrame;
@ -161,7 +160,7 @@ public class Main {
try {
checkUpdate();
} catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to check for updates", e);
debug.log(Level.WARNING, "Failed to check for updates", e);
}
}
@ -170,7 +169,7 @@ public class Main {
try {
checkGettingStarted();
} catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.WARNING, "Failed to show Getting Started help", e);
debug.log(Level.WARNING, "Failed to show Getting Started help", e);
}
}
} catch (CmdLineException e) {
@ -179,7 +178,7 @@ public class Main {
System.exit(-1);
} catch (Throwable e) {
// unexpected error => dump stack
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Unexpected error during startup", e);
debug.log(Level.SEVERE, "Unexpected error during startup", e);
System.exit(-1);
}
}
@ -197,7 +196,7 @@ public class Main {
// use native LaF an all platforms
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
debug.log(Level.WARNING, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
// default frame
@ -379,7 +378,7 @@ public class Main {
try {
Desktop.getDesktop().browse(URI.create(uri));
} catch (Exception e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Failed to open URI: " + uri, e);
debug.log(Level.SEVERE, "Failed to open URI: " + uri, e);
}
}
@ -434,7 +433,7 @@ public class Main {
System.setSecurityManager(new SecurityManager());
} catch (Exception e) {
// security manager was probably set via system property
Logger.getLogger(Main.class.getName()).log(Level.WARNING, e.toString(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}

View File

@ -1,5 +1,6 @@
package net.filebot;
import static net.filebot.Logging.*;
import static net.filebot.util.FileUtilities.*;
import java.awt.GraphicsEnvironment;
@ -10,7 +11,6 @@ import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
@ -129,7 +129,7 @@ public final class Settings {
return Integer.parseInt(threadPool);
}
} catch (Exception e) {
Logger.getLogger(Settings.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.getMessage(), e);
}
return Runtime.getRuntime().availableProcessors();

View File

@ -2,6 +2,7 @@ package net.filebot;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.similarity.Normalization.*;
import static net.filebot.util.ui.SwingUI.*;
@ -17,7 +18,6 @@ import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
@ -37,7 +37,7 @@ public class UserFiles {
try {
Desktop.getDesktop().open(it);
} catch (Exception e) {
Logger.getLogger(UserFiles.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.SEVERE, e.getMessage(), e);
}
});
}

View File

@ -3,6 +3,7 @@ package net.filebot;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.media.MediaDetection.*;
import static net.filebot.util.FileUtilities.*;
@ -15,7 +16,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.media.XattrMetaInfoProvider;
import net.filebot.similarity.MetricAvg;
@ -231,7 +231,7 @@ public final class WebServices {
return values;
}
} catch (Exception e) {
Logger.getLogger(WebServices.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
return new String[] { "", "" };
}

View File

@ -1,7 +1,6 @@
package net.filebot.archive;
import java.util.logging.Logger;
import static net.filebot.Logging.*;
import net.sf.sevenzipjbinding.IArchiveOpenCallback;
import net.sf.sevenzipjbinding.IInArchive;
import net.sf.sevenzipjbinding.IInStream;
@ -27,7 +26,7 @@ public class SevenZipLoader {
System.loadLibrary("libgcc_s_seh-1");
}
} catch (Throwable e) {
Logger.getLogger(SevenZipLoader.class.getName()).warning("Failed to preload library: " + e);
debug.warning("Failed to preload library: " + e);
}
System.loadLibrary("7-Zip-JBinding");

View File

@ -1,6 +1,7 @@
package net.filebot.cli;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.util.FileUtilities.*;
import java.io.File;
@ -11,7 +12,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.Language;
@ -152,7 +152,7 @@ public class ArgumentBean {
try {
file = file.getCanonicalFile();
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, String.format("Illegal Argument: %s (%s)", e, argument));
debug.warning(format("Illegal Argument: %s (%s)", e, argument));
}
if (resolveFolders && file.isDirectory()) {

View File

@ -2,6 +2,7 @@ package net.filebot.cli;
import static java.nio.file.StandardWatchEventKinds.*;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.util.FileUtilities.*;
import java.io.Closeable;
@ -22,7 +23,6 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.util.DefaultThreadFactory;
import net.filebot.util.Timer;
@ -148,7 +148,7 @@ public abstract class FolderWatchService implements Closeable {
commitSet.addAll(listFiles(file));
watchFolder(file);
} catch (IOException e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
}
}
@ -197,7 +197,7 @@ public abstract class FolderWatchService implements Closeable {
} catch (InterruptedException e) {
// ignore, part of an orderly shutdown
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}

View File

@ -1,11 +1,10 @@
package net.filebot.format;
import static net.filebot.Logging.*;
import static net.filebot.media.MediaDetection.*;
import java.io.File;
import java.io.FileFilter;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ExpressionFileFilter implements FileFilter {
@ -26,7 +25,7 @@ public class ExpressionFileFilter implements FileFilter {
try {
return filter.matches(new MediaBindingBean(readMetaInfo(f), f, null));
} catch (Exception e) {
Logger.getLogger(ExpressionFileFilter.class.getName()).log(Level.WARNING, e.toString());
debug.warning(format("Expression failed: %s", e));
return error;
}
}

View File

@ -2,6 +2,8 @@
package net.filebot.hash;
import static net.filebot.Logging.*;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
@ -10,8 +12,6 @@ import java.util.Iterator;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
public class VerificationFileReader implements Iterator<Entry<File, String>>, Closeable {
@ -71,7 +71,7 @@ public class VerificationFileReader implements Iterator<Entry<File, String>>, Cl
entry = format.parseObject(line);
} catch (ParseException e) {
// log and ignore
Logger.getLogger(getClass().getName()).log(Level.WARNING, String.format("Illegal format on line %d: %s", lineNumber, line));
debug.warning(format("Illegal format on line %d: %s", lineNumber, line));
}
}

View File

@ -38,8 +38,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -75,7 +73,7 @@ public class DropToUnlock extends JList<File> {
try {
NSURL_URLByResolvingBookmarkData_startAccessingSecurityScopedResource(persistentSecurityScopedBookmarks.get(bookmarkForFolder.get().getPath()));
} catch (Throwable e) {
Logger.getLogger(DropToUnlock.class.getName()).log(Level.WARNING, "NSURL.URLByResolvingBookmarkData.startAccessingSecurityScopedResource: " + e.toString());
debug.severe("NSURL.URLByResolvingBookmarkData.startAccessingSecurityScopedResource: " + e);
}
}
}
@ -92,7 +90,7 @@ public class DropToUnlock extends JList<File> {
String bookmarkData = NSURL_bookmarkDataWithOptions(folder.getPath());
persistentSecurityScopedBookmarks.put(folder.getPath(), bookmarkData);
} catch (Throwable e) {
Logger.getLogger(DropToUnlock.class.getName()).log(Level.WARNING, "NSURL.bookmarkDataWithOptions: " + e.toString());
debug.severe("NSURL.bookmarkDataWithOptions: " + e);
}
}
}

View File

@ -1,6 +1,7 @@
package net.filebot.mac;
import static ca.weblite.objc.util.CocoaUtils.*;
import static net.filebot.Logging.*;
import java.awt.EventQueue;
import java.awt.SecondaryLoop;
@ -11,8 +12,6 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JMenuBar;
import javax.swing.UIManager;
@ -98,7 +97,7 @@ public class MacAppUtilities {
Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", new Class<?>[] { Window.class, boolean.class });
setWindowCanFullScreen.invoke(null, window, true);
} catch (Throwable t) {
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setWindowCanFullScreen not supported: " + t);
debug.warning("setWindowCanFullScreen not supported: " + t);
}
}
@ -109,7 +108,7 @@ public class MacAppUtilities {
Method requestForeground = application.getMethod("requestForeground", new Class<?>[] { boolean.class });
requestForeground.invoke(instance, true);
} catch (Throwable t) {
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "requestForeground not supported: " + t);
debug.warning("requestForeground not supported: " + t);
}
}
@ -119,7 +118,7 @@ public class MacAppUtilities {
Method revealInFinder = fileManager.getMethod("revealInFinder", new Class<?>[] { File.class });
revealInFinder.invoke(null, file);
} catch (Throwable t) {
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "revealInFinder not supported: " + t);
debug.warning("revealInFinder not supported: " + t);
}
}
@ -130,7 +129,7 @@ public class MacAppUtilities {
Method setDefaultMenuBar = application.getMethod("setDefaultMenuBar", new Class<?>[] { JMenuBar.class });
setDefaultMenuBar.invoke(instance, menu);
} catch (Throwable t) {
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setDefaultMenuBar not supported: " + t);
debug.warning("setDefaultMenuBar not supported: " + t);
}
}
@ -143,7 +142,7 @@ public class MacAppUtilities {
Object closeAllWindows = quitStrategy.getField(field).get(null);
setQuitStrategy.invoke(instance, closeAllWindows);
} catch (Throwable t) {
Logger.getLogger(MacAppUtilities.class.getName()).log(Level.WARNING, "setQuitStrategy not supported: " + t);
debug.warning("setQuitStrategy not supported: " + t);
}
}

View File

@ -39,7 +39,6 @@ import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -81,7 +80,7 @@ public class MediaDetection {
try {
return releaseInfo.getClutterFileFilter();
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.SEVERE, "Unable to access clutter file filter: " + e.getMessage(), e);
debug.log(Level.SEVERE, "Unable to access clutter file filter: " + e.getMessage(), e);
}
return ((File f) -> false);
}
@ -319,14 +318,14 @@ public class MediaDetection {
unids.add(it.getName());
}
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to lookup info by id: " + e);
debug.warning("Failed to lookup info by id: " + e);
}
// try to detect series name via known patterns
try {
unids.addAll(matchSeriesByDirectMapping(files));
unids.addAll(matchSeriesByMapping(files));
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match direct mappings: " + e);
debug.warning("Failed to match direct mappings: " + e);
}
// guessed queries
@ -389,7 +388,7 @@ public class MediaDetection {
names.addAll(matches);
}
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match folder structure: " + e);
debug.warning("Failed to match folder structure: " + e);
}
// match common word sequence and clean detected word sequence from unwanted elements
@ -437,7 +436,7 @@ public class MediaDetection {
priorityMatchSet.addAll(stripReleaseInfo(matches, false));
matches = stripBlacklistedTerms(priorityMatchSet);
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to clean matches: " + e);
debug.warning("Failed to clean matches: " + e);
}
names.addAll(matches);
@ -445,7 +444,7 @@ public class MediaDetection {
return getUniqueQuerySet(unids, names);
}
public static List<String> matchSeriesByDirectMapping(Collection<File> files) throws Exception {
public static List<String> matchSeriesByMapping(Collection<File> files) throws Exception {
Map<Pattern, String> patterns = releaseInfo.getSeriesMappings();
List<String> matches = new ArrayList<String>();
@ -472,7 +471,7 @@ public class MediaDetection {
}
} catch (Exception e) {
// can't load movie index, just try again next time
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.SEVERE, "Failed to load series index: " + e);
debug.severe("Failed to load series index: " + e);
// rely on online search
return emptyList();
@ -494,7 +493,7 @@ public class MediaDetection {
}
} catch (Exception e) {
// can't load movie index, just try again next time
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.SEVERE, "Failed to load anime index: " + e);
debug.severe("Failed to load anime index: " + e);
// rely on online search
return emptyList();
@ -853,7 +852,7 @@ public class MediaDetection {
}
} catch (Exception e) {
// can't load movie index, just try again next time
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.SEVERE, "Failed to load movie index: " + e);
debug.severe("Failed to load movie index: " + e);
// if we can't use internal index we can only rely on online search
return emptyList();
@ -1188,7 +1187,7 @@ public class MediaDetection {
String text = new String(readFile(nfo), "UTF-8");
collection.addAll(grepImdbId(text));
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to read nfo: " + e.getMessage());
debug.warning("Failed to read nfo: " + e.getMessage());
}
}
@ -1466,7 +1465,7 @@ public class MediaDetection {
}
} catch (Exception e) {
// negative values for invalid files
Logger.getLogger(MediaDetection.class.getClass().getName()).warning(String.format("Unable to read media info: %s [%s]", e.getMessage(), f.getName()));
debug.warning(format("Unable to read media info: %s [%s]", e.getMessage(), f.getName()));
Arrays.fill(v, -1);
return v;
@ -1500,7 +1499,7 @@ public class MediaDetection {
return metaObject;
}
} catch (Throwable e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Unable to read xattr: " + e.getMessage());
debug.warning("Unable to read xattr: " + e.getMessage());
}
}
return null;
@ -1533,7 +1532,7 @@ public class MediaDetection {
if (e instanceof RuntimeException && e.getCause() instanceof IOException) {
e = (IOException) e.getCause();
}
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set creation date: " + e.getMessage());
debug.warning("Failed to set creation date: " + e.getMessage());
}
}
@ -1550,11 +1549,11 @@ public class MediaDetection {
if (e instanceof RuntimeException && e.getCause() instanceof IOException) {
e = (IOException) e.getCause();
}
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Failed to set xattr: " + e.getMessage());
debug.warning("Failed to set xattr: " + e.getMessage());
}
}
} catch (Throwable t) {
Logger.getLogger(MediaDetection.class.getClass().getName()).warning("Unable to store xattr: " + t.getMessage());
debug.warning("Unable to store xattr: " + t.getMessage());
}
}
}
@ -1563,7 +1562,7 @@ public class MediaDetection {
// load filter data
MediaDetection.getClutterFileFilter();
MediaDetection.getDiskFolderFilter();
MediaDetection.matchSeriesByDirectMapping(emptyList());
MediaDetection.matchSeriesByMapping(emptyList());
// load movie/series index
MediaDetection.stripReleaseInfo(singleton(""), true);

View File

@ -1,5 +1,7 @@
package net.filebot.mediainfo;
import static net.filebot.Logging.*;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
@ -10,8 +12,6 @@ import java.util.EnumMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.sun.jna.Platform;
import com.sun.jna.Pointer;
@ -41,7 +41,7 @@ public class MediaInfo implements Closeable {
try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
return openViaBuffer(raf);
} catch (IOException e) {
Logger.getLogger(MediaInfo.class.getName()).log(Level.WARNING, e.toString());
debug.warning("Failed to open random access file: " + e.getMessage());
return false;
}
}

View File

@ -3,6 +3,7 @@ package net.filebot.similarity;
import static java.lang.Math.*;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static net.filebot.Logging.*;
import static net.filebot.media.MediaDetection.*;
import static net.filebot.similarity.Normalization.*;
import static net.filebot.util.FileUtilities.*;
@ -20,8 +21,6 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -348,12 +347,12 @@ public enum EpisodeMetrics implements SimilarityMetric {
// check direct mappings first
try {
List<String> directMapping = matchSeriesByDirectMapping(singleton(file));
List<String> directMapping = matchSeriesByMapping(singleton(file));
if (directMapping.size() > 0) {
return directMapping;
}
} catch (Exception e) {
Logger.getLogger(EpisodeMetrics.class.getName()).log(Level.WARNING, e.getMessage());
debug.warning("Failed to retrieve series mappings: " + e.getMessage());
}
// guess potential series names from path
@ -371,7 +370,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
try {
return stripReleaseInfo(names, true);
} catch (Exception e) {
Logger.getLogger(EpisodeMetrics.class.getName()).log(Level.WARNING, e.getMessage());
debug.warning("Failed to strip release info: " + e.toString());
}
}

View File

@ -2,6 +2,7 @@ package net.filebot.subtitle;
import static java.lang.Math.*;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.media.MediaDetection.*;
import static net.filebot.similarity.EpisodeMetrics.*;
import static net.filebot.util.FileUtilities.*;
@ -11,8 +12,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -182,7 +181,7 @@ public enum SubtitleMetrics implements SimilarityMetric {
}
return props;
} catch (Exception e) {
Logger.getLogger(SubtitleMetrics.class.getName()).log(Level.WARNING, e.toString());
debug.warning("Failed to read subtitle properties: " + e);
}
return emptyMap();
}
@ -207,7 +206,7 @@ public enum SubtitleMetrics implements SimilarityMetric {
return props;
}
} catch (Exception e) {
Logger.getLogger(SubtitleMetrics.class.getName()).log(Level.WARNING, e.toString());
debug.warning("Failed to read video properties: " + e);
}
return emptyMap();
});

View File

@ -1,30 +1,24 @@
package net.filebot.subtitle;
import static net.filebot.Logging.*;
import java.io.Closeable;
import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
public abstract class SubtitleReader implements Iterator<SubtitleElement>, Closeable {
protected final Scanner scanner;
protected SubtitleElement current;
public SubtitleReader(Readable source) {
this.scanner = new Scanner(source);
}
protected abstract SubtitleElement readNext() throws Exception;
@Override
public boolean hasNext() {
// find next element
@ -33,14 +27,13 @@ public abstract class SubtitleReader implements Iterator<SubtitleElement>, Close
current = readNext();
} catch (Exception e) {
// log and ignore
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Illegal input: " + e.getMessage());
debug.warning("Illegal input: " + e.getMessage());
}
}
return current != null;
}
@Override
public SubtitleElement next() {
if (!hasNext()) {
@ -54,13 +47,11 @@ public abstract class SubtitleReader implements Iterator<SubtitleElement>, Close
}
}
@Override
public void close() throws IOException {
scanner.close();
}
@Override
public void remove() {
throw new UnsupportedOperationException();

View File

@ -3,6 +3,7 @@ package net.filebot.subtitle;
import static java.lang.Math.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import static net.filebot.Logging.*;
import static net.filebot.MediaTypes.*;
import static net.filebot.media.MediaDetection.*;
import static net.filebot.similarity.Normalization.*;
@ -29,8 +30,6 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Predicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -154,7 +153,7 @@ public final class SubtitleUtilities {
try {
selection.addAll(service.guess(getName(f)));
} catch (Exception e) {
Logger.getLogger(SubtitleUtilities.class.getName()).log(Level.WARNING, String.format("Failed to identify file [%s]: %s", f.getName(), e.getMessage()));
debug.warning(format("Failed to identify file [%s]: %s", f.getName(), e.getMessage()));
}
}
}

View File

@ -15,7 +15,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
@ -96,7 +95,7 @@ public abstract class AbstractSearchPanel<S, E> extends JComponent {
searchHistory.clear();
searchHistory.addAll(get());
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}
@ -110,7 +109,7 @@ public abstract class AbstractSearchPanel<S, E> extends JComponent {
searchTextField.getSelectButton().setSelectedIndex(Integer.parseInt(getSettings().get("engine.selected", "0")));
} catch (Exception e) {
// log and ignore
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
// save selected client on change

View File

@ -1,11 +1,11 @@
package net.filebot.ui;
import static net.filebot.Logging.*;
import static net.filebot.util.ui.SwingUI.*;
import java.awt.Desktop;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.JMenu;
@ -31,7 +31,7 @@ public class FileBotMenuBar {
try {
Desktop.getDesktop().browse(uri);
} catch (Exception e) {
Logger.getLogger(FileBotMenuBar.class.getName()).log(Level.SEVERE, "Failed to open URI: " + uri, e);
debug.log(Level.SEVERE, "Failed to open URI: " + uri, e);
}
});
}

View File

@ -1,5 +1,6 @@
package net.filebot.ui;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import java.awt.Desktop;
@ -7,7 +8,6 @@ import java.lang.reflect.Field;
import java.net.URI;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import javafx.animation.Interpolator;
@ -109,18 +109,18 @@ public class GettingStartedStage {
com.sun.webkit.WebPage page = (com.sun.webkit.WebPage) f.get(engine);
page.setBackgroundColor(color);
} catch (Exception e) {
Logger.getLogger(GettingStartedStage.class.getName()).log(Level.WARNING, "Failed to set background", e);
debug.log(Level.WARNING, "Failed to set background", e);
}
}
protected WebEngine onPopup(WebView webview) {
// get currently select image via Galleria API
Object link = webview.getEngine().executeScript("$('.galleria').data('galleria').getData().link");
Object uri = webview.getEngine().executeScript("$('.galleria').data('galleria').getData().link");
try {
Desktop.getDesktop().browse(new URI(link.toString()));
Desktop.getDesktop().browse(new URI(uri.toString()));
} catch (Exception e) {
Logger.getLogger(GettingStartedStage.class.getName()).log(Level.WARNING, "Failed to browse URI", e);
debug.log(Level.SEVERE, "Failed to open URI: " + uri, e);
}
// prevent current web view from opening the link

View File

@ -21,7 +21,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.JComponent;
@ -143,7 +142,7 @@ public class MainFrame extends JFrame {
pad.setLocationByPlatform(true);
pad.setVisible(true);
} catch (IOException e) {
Logger.getLogger(GroovyPad.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
} finally {
setCursor(Cursor.getDefaultCursor());
}

View File

@ -1,13 +1,12 @@
package net.filebot.ui.analyze;
import static net.filebot.Logging.*;
import static net.filebot.MediaTypes.*;
import java.awt.Color;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JScrollPane;
@ -78,7 +77,7 @@ class AttributeTool extends Tool<TableModel> {
model.addRow(metaId, metaObject, originalName, file);
} catch (Exception e) {
Logger.getLogger(AttributeTool.class.getName()).log(Level.WARNING, e.getMessage());
debug.warning("Failed to read xattr: " + e);
}
}
}

View File

@ -1,12 +1,13 @@
package net.filebot.ui.analyze;
import static net.filebot.Logging.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
import javax.swing.SwingWorker;
@ -79,7 +80,7 @@ abstract class Tool<M> extends JComponent {
// if it happens, it is supposed to
} else {
// should not happen
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}
}

View File

@ -13,7 +13,6 @@ import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.media.MediaDetection;
import net.filebot.ui.transfer.BackgroundFileTransferablePolicy;
@ -83,7 +82,7 @@ class FilesListTransferablePolicy extends BackgroundFileTransferablePolicy<File>
queue.addAll(0, paths); // add paths from text file
}
} catch (Exception e) {
Logger.getLogger(FilesListTransferablePolicy.class.getName()).log(Level.WARNING, e.getMessage());
debug.log(Level.WARNING, e.getMessage(), e);
}
} else if (!recursive || f.isFile() || MediaDetection.isDiskFolder(f)) {
entries.add(f);

View File

@ -39,7 +39,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.script.ScriptException;
import javax.swing.AbstractAction;
@ -418,7 +417,7 @@ public class FormatDialog extends JDialog {
try {
formatExample.setText(get());
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
}
}.execute();
@ -451,7 +450,7 @@ public class FormatDialog extends JDialog {
String sample = bundle.getString(mode.key() + ".sample");
info = JsonReader.jsonToJava(sample);
} catch (Exception illegalSample) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.SEVERE, "Illegal Sample", e);
debug.log(Level.SEVERE, "Illegal Sample", e);
}
}
@ -482,10 +481,10 @@ public class FormatDialog extends JDialog {
threadGroup.stop();
// log access of potentially unsafe method
Logger.getLogger(getClass().getName()).warning("Thread was forcibly terminated");
debug.warning("Thread was forcibly terminated");
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Thread was not terminated", e);
debug.log(Level.WARNING, "Thread was not terminated", e);
}
return remaining;
@ -680,7 +679,7 @@ public class FormatDialog extends JDialog {
mode.persistentSample().setValue(info == null ? "" : JsonWriter.objectToJson(info));
persistentSampleFile.setValue(file == null ? "" : sample.getFileObject().getAbsolutePath());
} catch (Exception e) {
Logger.getLogger(FormatDialog.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
// reevaluate everything

View File

@ -2,11 +2,12 @@
package net.filebot.ui.rename;
import static net.filebot.Logging.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Insets;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -68,7 +69,7 @@ class HighlightListCellRenderer extends AbstractFancyListCellRenderer {
textComponent.getHighlighter().addHighlight(matcher.start(0), matcher.end(0), highlightPainter);
} catch (BadLocationException e) {
//should not happen
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
}
}
}

View File

@ -5,6 +5,7 @@ import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static javax.swing.JOptionPane.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.UserFiles.*;
import static net.filebot.util.FileUtilities.*;
@ -34,7 +35,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -554,7 +554,7 @@ class HistoryDialog extends JDialog {
new MetaAttributes(destination).clear();
}
} catch (Exception e) {
Logger.getLogger(HistoryDialog.class.getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.ui.rename;
import static net.filebot.Logging.*;
import static net.filebot.util.ui.SwingUI.*;
import java.awt.Cursor;
@ -11,7 +12,6 @@ import java.util.List;
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;
@ -65,7 +65,7 @@ class MatchAction extends AbstractAction {
// display progress dialog and stop blocking EDT
dialog.setVisible(true);
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
} finally {
window.setCursor(Cursor.getDefaultCursor());
}
@ -121,7 +121,7 @@ class MatchAction extends AbstractAction {
// insert objects that could not be matched at the end of the model
model.addAll(matcher.remainingValues(), matcher.remainingCandidates());
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
}
}

View File

@ -1,6 +1,7 @@
package net.filebot.ui.rename;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.MediaTypes.*;
import static net.filebot.Settings.*;
import static net.filebot.media.MediaDetection.*;
@ -35,7 +36,6 @@ import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RunnableFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Action;
import javax.swing.SwingUtilities;
@ -145,7 +145,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
}
}
} catch (NoSuchElementException e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to grep IMDbID: " + nfo.getName());
debug.log(Level.WARNING, "Failed to grep IMDbID: " + nfo.getName());
}
}

View File

@ -31,7 +31,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 java.util.stream.Collectors;
import java.util.stream.Stream;
@ -131,7 +130,7 @@ class RenameAction extends AbstractAction {
}
}
} catch (Throwable e) {
Logger.getLogger(RenameAction.class.getName()).warning("Failed to write xattr: " + e.getMessage());
debug.warning("Failed to write xattr: " + e.getMessage());
}
}
} catch (ExecutionException e) {
@ -343,7 +342,7 @@ class RenameAction extends AbstractAction {
if (!isCancelled()) {
log.log(Level.SEVERE, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), e);
} else {
Logger.getLogger(RenameAction.class.getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
}
}

View File

@ -29,7 +29,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CancellationException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
@ -273,7 +272,7 @@ public class RenamePanel extends JComponent {
UserFiles.revealFiles(list.getSelectedValuesList());
}
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage());
debug.log(Level.WARNING, e.getMessage());
} finally {
getWindow(evt.getSource()).setCursor(Cursor.getDefaultCursor());
}
@ -298,7 +297,7 @@ public class RenamePanel extends JComponent {
showFormatEditor(sample);
}
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
} finally {
getWindow(evt.getSource()).setCursor(Cursor.getDefaultCursor());
}
@ -369,7 +368,7 @@ public class RenamePanel extends JComponent {
}
}
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage());
debug.log(Level.WARNING, e.getMessage());
}
}
});
@ -389,7 +388,7 @@ public class RenamePanel extends JComponent {
Preset p = (Preset) JsonReader.jsonToJava(it);
actionPopup.add(new ApplyPresetAction(p));
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
}
}
actionPopup.addSeparator();
@ -436,7 +435,7 @@ public class RenamePanel extends JComponent {
break;
}
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
}
}
});
@ -516,7 +515,7 @@ public class RenamePanel extends JComponent {
}
orderCombo.setSelectedItem(SortOrder.forName(persistentPreferredEpisodeOrder.getValue()));
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
JScrollPane spModeCombo = new JScrollPane(modeCombo, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
@ -591,7 +590,7 @@ public class RenamePanel extends JComponent {
try {
initMode = Mode.valueOf(persistentLastFormatState.getValue());
} catch (Exception e) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, e.getMessage());
debug.log(Level.WARNING, e.getMessage());
}
}
@ -890,7 +889,7 @@ public class RenamePanel extends JComponent {
renameModel.files().addAll(remainingFiles);
} catch (Exception e) {
if (findCause(e, CancellationException.class) != null) {
Logger.getLogger(RenamePanel.class.getName()).log(Level.WARNING, getRootCause(e).toString());
debug.log(Level.WARNING, getRootCause(e).toString());
} else {
log.log(Level.WARNING, String.format("%s: %s", getRootCause(e).getClass().getSimpleName(), getRootCauseMessage(e)), e);
}

View File

@ -3,6 +3,7 @@ package net.filebot.ui.rename;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.util.FileUtilities.*;
import static net.filebot.util.ui.SwingUI.*;
@ -20,7 +21,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import javax.swing.AbstractAction;
@ -74,7 +74,7 @@ class ValidateDialog extends JDialog {
textComponent.getHighlighter().addHighlight(matcher.start(0), matcher.end(0), highlightPainter);
} catch (BadLocationException e) {
//should not happen
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
}
}
}

View File

@ -2,6 +2,7 @@ package net.filebot.ui.subtitle;
import static javax.swing.BorderFactory.*;
import static javax.swing.JOptionPane.*;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.subtitle.SubtitleUtilities.*;
import static net.filebot.util.FileUtilities.*;
@ -32,7 +33,6 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
@ -291,7 +291,7 @@ class SubtitleAutoMatchDialog extends JDialog {
try {
mapping.setSubtitleFile(get());
} catch (Exception e) {
Logger.getLogger(SubtitleAutoMatchDialog.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}
});
@ -785,7 +785,7 @@ class SubtitleAutoMatchDialog extends JDialog {
throw e;
} catch (Exception e) {
// log and ignore
Logger.getLogger(SubtitleAutoMatchDialog.class.getName()).log(Level.WARNING, e.getMessage());
debug.log(Level.WARNING, e.getMessage());
}
}
@ -833,7 +833,7 @@ class SubtitleAutoMatchDialog extends JDialog {
return destination;
} catch (Exception e) {
Logger.getLogger(SubtitleAutoMatchDialog.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
return null;

View File

@ -22,7 +22,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -377,7 +376,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
// logout from test session
osdb.logout();
} catch (Exception e) {
Logger.getLogger(SubtitlePanel.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
}
});
} else if (osdbUser.getText().isEmpty()) {

View File

@ -10,7 +10,6 @@ import java.io.File;
import java.util.EventObject;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTable;
import javax.swing.event.CellEditorListener;
@ -87,7 +86,7 @@ class MovieEditor implements TableCellEditor {
// print error message
if (error != null) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, error.toString());
debug.log(Level.WARNING, error.toString());
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.ui.subtitle.upload;
import static net.filebot.Logging.*;
import static net.filebot.media.MediaDetection.*;
import static net.filebot.util.ui.SwingUI.*;
@ -18,7 +19,6 @@ import java.util.Map.Entry;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
@ -154,7 +154,7 @@ public class SubtitleUploadDialog extends JDialog {
Locale locale = database.detectLanguage(FileUtilities.readFile(mapping.getSubtitle()));
mapping.setLanguage(Language.getLanguage(locale));
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to auto-detect language: " + e.getMessage());
debug.log(Level.WARNING, "Failed to auto-detect language: " + e.getMessage());
}
}
@ -187,7 +187,7 @@ public class SubtitleUploadDialog extends JDialog {
}
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Failed to auto-detect movie: " + e.getMessage());
debug.log(Level.WARNING, "Failed to auto-detect movie: " + e.getMessage());
}
}
@ -199,7 +199,7 @@ public class SubtitleUploadDialog extends JDialog {
mapping.setState(Status.UploadReady);
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
mapping.setState(Status.CheckFailed);
}
}
@ -210,7 +210,7 @@ public class SubtitleUploadDialog extends JDialog {
database.uploadSubtitle(group.getIdentity(), group.getLanguage().getLocale(), group.getVideoFiles(), group.getSubtitleFiles());
group.setState(Status.UploadComplete);
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);
debug.log(Level.SEVERE, e.getMessage(), e);
group.setState(Status.UploadFailed);
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.ui.transfer;
import static net.filebot.Logging.*;
import static net.filebot.Settings.*;
import static net.filebot.util.FileUtilities.*;
@ -17,7 +18,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.filebot.gio.GVFS;
@ -127,7 +127,7 @@ public class FileTransferable implements Transferable {
file = GVFS.getPathForURI(uri);
}
} catch (LinkageError error) {
Logger.getLogger(FileTransferable.class.getName()).log(Level.WARNING, "Unable to resolve GVFS URI", error);
debug.log(Level.WARNING, "Unable to resolve GVFS URI", error);
}
}
@ -138,7 +138,7 @@ public class FileTransferable implements Transferable {
files.add(file);
} catch (Throwable e) {
// URISyntaxException, IllegalArgumentException, FileNotFoundException, LinkageError, etc
Logger.getLogger(FileTransferable.class.getName()).log(Level.WARNING, "Invalid file URI: " + line);
debug.log(Level.WARNING, "Invalid file URI: " + line);
}
}

View File

@ -1,5 +1,6 @@
package net.filebot.ui.transfer;
import static net.filebot.Logging.*;
import static net.filebot.UserFiles.*;
import static net.filebot.util.FileUtilities.*;
@ -7,7 +8,6 @@ import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
@ -56,7 +56,7 @@ public class SaveAction extends AbstractAction {
}
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
}
}
}

View File

@ -2,10 +2,11 @@
package net.filebot.ui.transfer;
import static net.filebot.Logging.*;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.InvalidDnDOperationException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.TransferHandler;
import javax.swing.TransferHandler.TransferSupport;
@ -33,7 +34,7 @@ public abstract class TransferablePolicy {
// just assume that the transferable will be accepted, accept will be called in importData again anyway
return true;
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.toString(), e);
debug.log(Level.WARNING, e.toString(), e);
return false;
}
}
@ -48,7 +49,7 @@ public abstract class TransferablePolicy {
return true;
}
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.toString(), e);
debug.log(Level.WARNING, e.toString(), e);
}
// transferable was not accepted, or transfer failed

View File

@ -3,6 +3,7 @@ package net.filebot.util;
import static java.nio.charset.StandardCharsets.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import java.io.BufferedInputStream;
import java.io.File;
@ -42,7 +43,6 @@ import java.util.SortedMap;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -67,7 +67,7 @@ public final class FileUtilities {
try {
return Files.move(source.toPath(), destination.toPath(), StandardCopyOption.ATOMIC_MOVE).toFile();
} catch (AtomicMoveNotSupportedException e) {
Logger.getLogger(FileUtilities.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
}
}

View File

@ -1,5 +1,7 @@
package net.filebot.util;
import static net.filebot.Logging.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@ -16,7 +18,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences;
@ -306,7 +307,7 @@ public class PreferencesMap<T> implements Map<String, T> {
try {
prefs.flush();
} catch (Exception e) {
Logger.getLogger(PreferencesMap.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
}
}

View File

@ -1,8 +1,9 @@
package net.filebot.util;
import static net.filebot.Logging.*;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
public class SystemProperty<T> {
@ -31,7 +32,7 @@ public class SystemProperty<T> {
try {
return valueFunction.apply(prop);
} catch (Exception e) {
Logger.getLogger(SystemProperty.class.getName()).logp(Level.WARNING, SystemProperty.class.getName(), key, e.toString());
debug.logp(Level.WARNING, SystemProperty.class.getName(), key, e.toString());
}
}

View File

@ -1,11 +1,12 @@
package net.filebot.util;
import static net.filebot.Logging.*;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
public abstract class Timer implements Runnable {
@ -33,7 +34,7 @@ public abstract class Timer implements Runnable {
addShutdownHook();
} catch (Exception e) {
// may fail if running with restricted permissions
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getClass().getName() + ": " + e.getMessage());
debug.log(Level.WARNING, e.getClass().getName() + ": " + e.getMessage());
}
// remove shutdown hook after execution
@ -54,7 +55,7 @@ public abstract class Timer implements Runnable {
removeShutdownHook();
} catch (Exception e) {
// may fail if running with restricted permissions
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getClass().getName() + ": " + e.getMessage());
debug.log(Level.WARNING, e.getClass().getName() + ": " + e.getMessage());
}
}

View File

@ -1,5 +1,7 @@
package net.filebot.util.ui;
import static net.filebot.Logging.*;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
@ -9,7 +11,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractAction;
import javax.swing.Action;
@ -107,7 +108,7 @@ public class LinkButton extends JButton {
}
} catch (Exception e) {
// should not happen
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
debug.log(Level.SEVERE, e.toString(), e);
}
}
}

View File

@ -1,6 +1,7 @@
package net.filebot.web;
import static java.nio.charset.StandardCharsets.*;
import static net.filebot.Logging.*;
import static net.filebot.util.JsonUtilities.*;
import static net.filebot.web.WebRequest.*;
@ -22,7 +23,6 @@ import java.util.Objects;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
@ -171,7 +171,7 @@ public class AcoustIDClient implements MusicIdentificationService {
return null;
}).filter(Objects::nonNull).findFirst().orElse(audioTrack); // default to simple music info if extended info is not available
} catch (Exception e) {
Logger.getLogger(AcoustIDClient.class.getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
return null;
}
}).filter(Objects::nonNull).sorted(new MostFieldsNotNull()).findFirst().get();
@ -241,7 +241,7 @@ public class AcoustIDClient implements MusicIdentificationService {
}
}
} catch (Exception e) {
Logger.getLogger(AcoustIDClient.class.getName()).log(Level.WARNING, e.toString(), e);
debug.log(Level.WARNING, e.toString(), e);
}
return n;
}

View File

@ -1,6 +1,7 @@
package net.filebot.web;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.util.StringUtilities.*;
import static net.filebot.util.XPathUtilities.*;
import static net.filebot.web.EpisodeUtilities.*;
@ -23,7 +24,6 @@ import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -175,7 +175,7 @@ public class AnidbClient extends AbstractEpisodeListProvider {
// sanity check
if (episodes.isEmpty()) {
// anime page xml doesn't work sometimes
Logger.getLogger(AnidbClient.class.getName()).log(Level.WARNING, String.format("Unable to parse episode data: %s (%d): %s", anime, anime.getAnimeId(), getXmlString(dom, false).split("\n", 2)[0].trim()));
debug.log(Level.WARNING, String.format("Unable to parse episode data: %s (%d): %s", anime, anime.getAnimeId(), getXmlString(dom, false).split("\n", 2)[0].trim()));
}
return new SeriesData(seriesInfo, episodes);

View File

@ -1,5 +1,6 @@
package net.filebot.web;
import static net.filebot.Logging.*;
import static net.filebot.util.StringUtilities.*;
import java.io.File;
@ -8,7 +9,6 @@ import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
@ -63,7 +63,7 @@ public class ID3Lookup implements MusicIdentificationService {
info.put(f, new AudioTrack(artist, title, album, albumArtist, trackTitle, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid));
}
} catch (Throwable e) {
Logger.getLogger(ID3Lookup.class.getName()).log(Level.WARNING, e.toString());
debug.log(Level.WARNING, e.toString());
} finally {
mediaInfo.close();
}

View File

@ -21,7 +21,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
@ -368,7 +367,7 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
try {
sublanguageid = getSubLanguageID(languageName, true);
} catch (Exception e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, e.getMessage(), e);
debug.log(Level.WARNING, e.getMessage(), e);
}
}

View File

@ -1,6 +1,7 @@
package net.filebot.web;
import static java.util.Collections.*;
import static net.filebot.Logging.*;
import static net.filebot.util.StringUtilities.*;
import java.io.ByteArrayInputStream;
@ -20,7 +21,6 @@ import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.DeflaterInputStream;
@ -134,7 +134,7 @@ public class OpenSubtitlesXmlRpc {
movies.add(new SubtitleSearchResult(Integer.parseInt(imdbid), name, year, null, -1));
} catch (Exception e) {
Logger.getLogger(OpenSubtitlesXmlRpc.class.getName()).log(Level.FINE, String.format("Ignore movie [%s]: %s", movie, e.getMessage()));
debug.log(Level.FINE, String.format("Ignore movie [%s]: %s", movie, e.getMessage()));
}
}
@ -157,7 +157,7 @@ public class OpenSubtitlesXmlRpc {
return new Movie(name, year, imdbid, -1);
} catch (RuntimeException e) {
// ignore, invalid response
Logger.getLogger(getClass().getName()).log(Level.WARNING, String.format("Failed to lookup movie by imdbid %s: %s", imdbid, e.getMessage()));
debug.log(Level.WARNING, String.format("Failed to lookup movie by imdbid %s: %s", imdbid, e.getMessage()));
}
return null;
@ -296,7 +296,7 @@ public class OpenSubtitlesXmlRpc {
movieHashMap.put(hash, matches.get(0));
} else if (matches.size() > 1) {
// multiple hash matches => ignore all
Logger.getLogger(getClass().getName()).log(Level.WARNING, "Ignore hash match due to hash collision: " + matches);
debug.log(Level.WARNING, "Ignore hash match due to hash collision: " + matches);
}
}
}

View File

@ -26,7 +26,6 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
@ -163,7 +162,7 @@ public class TMDbClient implements MovieIdentificationService {
return getMovieInfo(String.format("tt%07d", movie.getImdbId()), locale, extendedInfo);
}
} catch (FileNotFoundException | NullPointerException e) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, String.format("Movie data not found: %s [%d / %d]", movie, movie.getTmdbId(), movie.getImdbId()));
debug.log(Level.WARNING, String.format("Movie data not found: %s [%d / %d]", movie, movie.getTmdbId(), movie.getImdbId()));
}
return null;
}

View File

@ -21,7 +21,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
@ -107,7 +106,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
String seriesName = getTextContent("SeriesName", node);
if (seriesName.startsWith("**") && seriesName.endsWith("**")) {
Logger.getLogger(getClass().getName()).log(Level.WARNING, String.format("Invalid series: %s [%d]", seriesName, sid));
debug.log(Level.WARNING, String.format("Invalid series: %s [%d]", seriesName, sid));
continue;
}

View File

@ -1,6 +1,7 @@
package net.filebot.web;
import static java.nio.charset.StandardCharsets.*;
import static net.filebot.Logging.*;
import static net.filebot.util.FileUtilities.*;
import java.io.ByteArrayOutputStream;
@ -28,7 +29,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
@ -279,7 +279,7 @@ public final class WebRequest {
try {
return Charset.forName(matcher.group(1));
} catch (IllegalArgumentException e) {
Logger.getLogger(WebRequest.class.getName()).log(Level.WARNING, "Illegal charset: " + contentType);
debug.log(Level.WARNING, "Illegal charset: " + contentType);
}
}