diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 8d881fdf..0193aa08 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -66,7 +66,7 @@ import javax.swing.UnsupportedLookAndFeelException; */ public final class MainWindow implements Runnable, RipStatusHandler { - private static final Logger logger = Logger.getLogger(MainWindow.class); + private static final Logger LOGGER = Logger.getLogger(MainWindow.class); private boolean isRipping = false; // Flag to indicate if we're ripping something @@ -279,7 +279,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | UnsupportedLookAndFeelException | IllegalAccessException e) { - logger.error("[!] Exception setting system theme:", e); + LOGGER.error("[!] Exception setting system theme:", e); } ripTextfield = new JTextField("", 20); @@ -821,7 +821,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { chosenPath = chosenFile.getCanonicalPath(); } catch (Exception e) { - logger.error("Error while getting selected path: ", e); + LOGGER.error("Error while getting selected path: ", e); return; } configSaveDirLabel.setText(Utils.shortenPath(chosenPath)); @@ -877,7 +877,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { break; } Logger.getRootLogger().setLevel(newLevel); - logger.setLevel(newLevel); + LOGGER.setLevel(newLevel); ConsoleAppender ca = (ConsoleAppender)Logger.getRootLogger().getAppender("stdout"); if (ca != null) { ca.setThreshold(newLevel); @@ -951,7 +951,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { Desktop.getDesktop().browse(URI.create("http://github.com/ripmeapp/ripme")); } catch (IOException e) { - logger.error("Exception while opening project home page", e); + LOGGER.error("Exception while opening project home page", e); } } }); @@ -1024,10 +1024,10 @@ public final class MainWindow implements Runnable, RipStatusHandler { HISTORY.clear(); if (historyFile.exists()) { try { - logger.info(rb.getString("loading.history.from") + " " + historyFile.getCanonicalPath()); + LOGGER.info(rb.getString("loading.history.from") + " " + historyFile.getCanonicalPath()); HISTORY.fromFile(historyFile.getCanonicalPath()); } catch (IOException e) { - logger.error("Failed to load history from file " + historyFile, e); + LOGGER.error("Failed to load history from file " + historyFile, e); JOptionPane.showMessageDialog(null, "RipMe failed to load the history file at " + historyFile.getAbsolutePath() + "\n\n" + "Error: " + e.getMessage() + "\n\n" + @@ -1037,7 +1037,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { JOptionPane.ERROR_MESSAGE); } } else { - logger.info(rb.getString("loading.history.from.configuration")); + LOGGER.info(rb.getString("loading.history.from.configuration")); HISTORY.fromList(Utils.getConfigList("download.history")); if (HISTORY.toList().isEmpty()) { // Loaded from config, still no entries. @@ -1067,7 +1067,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { HISTORY.toFile(historyFile.toString()); Utils.setConfigList("download.history", Collections.emptyList()); } catch (IOException e) { - logger.error("Failed to save history to file " + historyFile, e); + LOGGER.error("Failed to save history to file " + historyFile, e); } } @@ -1089,7 +1089,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { Thread.sleep(500); } catch (InterruptedException ie) { - logger.error(rb.getString("interrupted.while.waiting.to.rip.next.album"), ie); + LOGGER.error(rb.getString("interrupted.while.waiting.to.rip.next.album"), ie); } ripNextAlbum(); } else { @@ -1113,7 +1113,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { url = new URL(urlString); } catch (MalformedURLException e) { - logger.error("[!] Could not generate URL for '" + urlString + "'", e); + LOGGER.error("[!] Could not generate URL for '" + urlString + "'", e); error("Given URL is not valid, expecting http://website.com/page/..."); return null; } @@ -1128,7 +1128,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { ripper.setup(); } catch (Exception e) { failed = true; - logger.error("Could not find ripper for URL " + url, e); + LOGGER.error("Could not find ripper for URL " + url, e); error(e.getMessage()); } if (!failed) { @@ -1146,7 +1146,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { } return t; } catch (Exception e) { - logger.error("[!] Error while ripping: " + e.getMessage(), e); + LOGGER.error("[!] Error while ripping: " + e.getMessage(), e); error("Unable to rip this URL: " + e.getMessage()); } } @@ -1197,28 +1197,28 @@ public final class MainWindow implements Runnable, RipStatusHandler { switch(msg.getStatus()) { case LOADING_RESOURCE: case DOWNLOAD_STARTED: - if (logger.isEnabledFor(Level.INFO)) { + if (LOGGER.isEnabledFor(Level.INFO)) { appendLog("Downloading " + msg.getObject(), Color.BLACK); } break; case DOWNLOAD_COMPLETE: - if (logger.isEnabledFor(Level.INFO)) { + if (LOGGER.isEnabledFor(Level.INFO)) { appendLog("Downloaded " + msg.getObject(), Color.GREEN); } break; case DOWNLOAD_ERRORED: - if (logger.isEnabledFor(Level.ERROR)) { + if (LOGGER.isEnabledFor(Level.ERROR)) { appendLog((String) msg.getObject(), Color.RED); } break; case DOWNLOAD_WARN: - if (logger.isEnabledFor(Level.WARN)) { + if (LOGGER.isEnabledFor(Level.WARN)) { appendLog((String) msg.getObject(), Color.ORANGE); } break; case RIP_ERRORED: - if (logger.isEnabledFor(Level.ERROR)) { + if (LOGGER.isEnabledFor(Level.ERROR)) { appendLog((String) msg.getObject(), Color.RED); } stopButton.setEnabled(false); @@ -1270,7 +1270,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { try { Desktop.getDesktop().open(new File(event.getActionCommand())); } catch (Exception e) { - logger.error(e); + LOGGER.error(e); } }); pack(); @@ -1341,7 +1341,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { Utils.setConfigInteger("window.y", y); Utils.setConfigInteger("window.w", w); Utils.setConfigInteger("window.h", h); - logger.debug("Saved window position (x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ")"); + LOGGER.debug("Saved window position (x=" + x + ", y=" + y + ", w=" + w + ", h=" + h + ")"); } private static void restoreWindowPosition(Frame frame) { @@ -1356,7 +1356,7 @@ public final class MainWindow implements Runnable, RipStatusHandler { int w = Utils.getConfigInteger("window.w", -1); int h = Utils.getConfigInteger("window.h", -1); if (x < 0 || y < 0 || w <= 0 || h <= 0) { - logger.debug("UNUSUAL: One or more of: x, y, w, or h was still less than 0 after reading config"); + LOGGER.debug("UNUSUAL: One or more of: x, y, w, or h was still less than 0 after reading config"); mainFrame.setLocationRelativeTo(null); // default to middle of screen return; }