diff --git a/src/net/apocalypselabs/symat/CodeEditor.java b/src/net/apocalypselabs/symat/CodeEditor.java index dfb8873..2dbc184 100644 --- a/src/net/apocalypselabs/symat/CodeEditor.java +++ b/src/net/apocalypselabs/symat/CodeEditor.java @@ -32,14 +32,8 @@ import java.awt.Component; import java.awt.Font; import java.io.BufferedReader; import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; -import java.io.PrintStream; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -63,8 +57,7 @@ public class CodeEditor extends javax.swing.JInternalFrame { private final JFileChooser fc = new JFileChooser(); private boolean isSaved = false; private RSyntaxTextArea codeBox = new RSyntaxTextArea(); - private RTextScrollPane sp; - private String lastSaved = ""; + private final RTextScrollPane sp; private boolean fileChanged = false; private CompletionProvider jscomp = new CodeCompleter("js").getProvider(); @@ -462,7 +455,6 @@ public class CodeEditor extends javax.swing.JInternalFrame { codeBox.setText(FileUtils.readFile(f.toString())); isSaved = true; filedata = f; - lastSaved = FileUtils.MD5(codeBox.getText()); setTitle("Editor - " + f.getName()); } catch (IOException ex) { JOptionPane.showInternalMessageDialog(this, diff --git a/src/net/apocalypselabs/symat/Debug.java b/src/net/apocalypselabs/symat/Debug.java index 37e97a6..389b1b0 100644 --- a/src/net/apocalypselabs/symat/Debug.java +++ b/src/net/apocalypselabs/symat/Debug.java @@ -49,6 +49,7 @@ public class Debug { } } + @SuppressWarnings(value = {"CallToPrintStackTrace"}) public static void stacktrace(Exception e) { if (DEBUG) { e.printStackTrace(); diff --git a/src/net/apocalypselabs/symat/FirstRun.java b/src/net/apocalypselabs/symat/FirstRun.java index 83dae05..9b499de 100644 --- a/src/net/apocalypselabs/symat/FirstRun.java +++ b/src/net/apocalypselabs/symat/FirstRun.java @@ -211,7 +211,7 @@ public class FirstRun extends javax.swing.JInternalFrame { private void contBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_contBtnActionPerformed if (noLicSel.isSelected()) { - if (PrefStorage.getSetting("licensetype").equals("demo") + if (PrefStorage.getSetting("licensetype").equals("demo") && PrefStorage.getSetting("licensedemo").equals("used")) { int ans = JOptionPane.showInternalConfirmDialog(this, "You have already used a trial license." @@ -219,7 +219,7 @@ public class FirstRun extends javax.swing.JInternalFrame { "Expired", JOptionPane.YES_NO_OPTION); if (ans == JOptionPane.NO_OPTION) { - + } else { openShop(); } @@ -292,7 +292,7 @@ public class FirstRun extends javax.swing.JInternalFrame { */ private class CheckThread extends Thread { - private String email; + private final String email; public CheckThread(String useremail) { email = useremail; @@ -303,12 +303,12 @@ public class FirstRun extends javax.swing.JInternalFrame { try { Debug.println("Checking license..."); URL url = new URL(API_URL + "liccheck.php?email=" + email); - InputStream is = url.openStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - - String line = br.readLine(); - br.close(); - is.close(); + String line; + try (InputStream is = url.openStream(); + BufferedReader br + = new BufferedReader(new InputStreamReader(is))) { + line = br.readLine(); + } switch (line) { case "ok:single": @@ -356,12 +356,13 @@ public class FirstRun extends javax.swing.JInternalFrame { JOptionPane.QUESTION_MESSAGE); Debug.println("Checking license code (" + code + ")..."); URL url = new URL(API_URL + "emailverify.php?code=" + code + "&email=" + email); - InputStream is = url.openStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(is)); - - String line = br.readLine(); - br.close(); - is.close(); + String line; + try (InputStream is = url.openStream()) { + BufferedReader br + = new BufferedReader(new InputStreamReader(is)); + line = br.readLine(); + br.close(); + } if (code.equals(line)) { success("domain"); } else { diff --git a/src/net/apocalypselabs/symat/FontOptions.java b/src/net/apocalypselabs/symat/FontOptions.java index 88860f3..54334f4 100644 --- a/src/net/apocalypselabs/symat/FontOptions.java +++ b/src/net/apocalypselabs/symat/FontOptions.java @@ -1,7 +1,7 @@ /* * Apocalypse Laboratories * Open Source License - * + * * Source code can be used for any purpose, as long as: * - Compiled binaries are rebranded and trademarks are not * visible by the end user at any time, except to give @@ -14,7 +14,7 @@ * - and you provide your modified source code for download, * under the terms of the GNU LGPL v3 or a comparable * license. - * + * * Compiled binaries cannot be redistributed or mirrored, * unless: * - You have written permission from Apocalypse Laboratories; @@ -22,7 +22,7 @@ * not even behind a paywall or other blocking mechanism; * - or you have received a multi-computer license, in which * case you should take measures to prevent unauthorized - * downloads, such as preventing download access from the + * downloads, such as preventing download access from the * Internet. */ package net.apocalypselabs.symat; @@ -40,7 +40,7 @@ public class FontOptions extends javax.swing.JPanel { public FontOptions() { initComponents(); } - + public FontOptions(int size) { this(); jSpinner1.setValue(size); @@ -104,7 +104,7 @@ public class FontOptions extends javax.swing.JPanel { public int getResult() { return (int) jSpinner1.getValue(); } - + public boolean isModified() { return modified; } diff --git a/src/net/apocalypselabs/symat/Functions.java b/src/net/apocalypselabs/symat/Functions.java index 5e9d3c3..382477d 100644 --- a/src/net/apocalypselabs/symat/Functions.java +++ b/src/net/apocalypselabs/symat/Functions.java @@ -1,7 +1,7 @@ -/* +/* * Apocalypse Laboratories * Open Source License - * + * * Source code can be used for any purpose, as long as: * - Compiled binaries are rebranded and trademarks are not * visible by the end user at any time, except to give @@ -14,7 +14,7 @@ * - and you provide your modified source code for download, * under the terms of the GNU LGPL v3 or a comparable * license. - * + * * Compiled binaries cannot be redistributed or mirrored, * unless: * - You have written permission from Apocalypse Laboratories; @@ -22,7 +22,7 @@ * not even behind a paywall or other blocking mechanism; * - or you have received a multi-computer license, in which * case you should take measures to prevent unauthorized - * downloads, such as preventing download access from the + * downloads, such as preventing download access from the * Internet. */ package net.apocalypselabs.symat; @@ -118,7 +118,7 @@ public class Functions { } } - /* + /* Graphing interfaces */ public void plotrange(double xmin, double xmax) { diff --git a/src/net/apocalypselabs/symat/Help.java b/src/net/apocalypselabs/symat/Help.java index c7f1b0b..763b005 100644 --- a/src/net/apocalypselabs/symat/Help.java +++ b/src/net/apocalypselabs/symat/Help.java @@ -1,7 +1,7 @@ -/* +/* * Apocalypse Laboratories * Open Source License - * + * * Source code can be used for any purpose, as long as: * - Compiled binaries are rebranded and trademarks are not * visible by the end user at any time, except to give @@ -14,7 +14,7 @@ * - and you provide your modified source code for download, * under the terms of the GNU LGPL v3 or a comparable * license. - * + * * Compiled binaries cannot be redistributed or mirrored, * unless: * - You have written permission from Apocalypse Laboratories; @@ -22,7 +22,7 @@ * not even behind a paywall or other blocking mechanism; * - or you have received a multi-computer license, in which * case you should take measures to prevent unauthorized - * downloads, such as preventing download access from the + * downloads, such as preventing download access from the * Internet. */ package net.apocalypselabs.symat; @@ -248,7 +248,7 @@ public class Help extends javax.swing.JInternalFrame { } setText(text, "Manual (" + topicList.getSelectedValue().toString() + ")"); } catch (Exception e) { - //JOptionPane.showInternalMessageDialog(MainGUI.mainPane, + //JOptionPane.showInternalMessageDialog(MainGUI.mainPane, //"Error: Cannot load help topic "+name+".\n\n"+e.getMessage()); setText("
Error:
Cannot get help topic \""
+ name + "\".
(" + e.getMessage() + ")