Code cleaned (unused imports, formatting, IDE warnings, etc)

This commit is contained in:
skylarmt 2015-01-11 03:39:23 -07:00
parent 629a8d0bc2
commit 9ccf1e3e7e
10 changed files with 46 additions and 50 deletions

View File

@ -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,

View File

@ -49,6 +49,7 @@ public class Debug {
}
}
@SuppressWarnings(value = {"CallToPrintStackTrace"})
public static void stacktrace(Exception e) {
if (DEBUG) {
e.printStackTrace();

View File

@ -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();
String line;
try (InputStream is = url.openStream()) {
BufferedReader br
= new BufferedReader(new InputStreamReader(is));
line = br.readLine();
br.close();
is.close();
}
if (code.equals(line)) {
success("domain");
} else {

View File

@ -31,8 +31,6 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
@ -452,7 +450,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
}
// Implement ans command
String ansfill = "";
String ansfill;
try {
ansfill = String.valueOf(Double.parseDouble(ans.toString()));
} catch (NumberFormatException ex) {
@ -463,6 +461,7 @@ public class Interpreter extends javax.swing.JInternalFrame {
}
@Override
@SuppressWarnings("null")
public void run() {
try {
if (doSpecialCommands()) {

View File

@ -29,12 +29,15 @@ package net.apocalypselabs.symat;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyVetoException;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Calendar;
import java.util.Date;
import javax.swing.ImageIcon;
@ -758,7 +761,7 @@ public class MainGUI extends javax.swing.JFrame {
ubuntuRegular = Font.createFont(Font.TRUETYPE_FONT,
new File(MainGUI.class.
getResource("resources/Ubuntu-R.ttf").toURI()));
} catch (Exception ex) {
} catch (URISyntaxException | FontFormatException | IOException ex) {
ubuntuRegular = Font.getFont(Font.SANS_SERIF);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B