[CLEANUP] Removed Bugsnag from project

This commit is contained in:
JKetelaar
2016-05-24 15:24:00 +02:00
parent f75f172d35
commit 463ef6cea8
7 changed files with 122 additions and 175 deletions
+4 -19
View File
@@ -59,24 +59,16 @@
<version>1.1.1</version> <version>1.1.1</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>junit</groupId> <groupId>*</groupId>
<artifactId>junit</artifactId> <artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.bugsnag</groupId>
<artifactId>bugsnag</artifactId>
<version>1.2.8</version>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.11</version> <version>4.11</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -90,14 +82,6 @@
<resource> <resource>
<directory>deploy</directory> <directory>deploy</directory>
<filtering>true</filtering> <filtering>true</filtering>
<excludes>
<exclude>deploy.bat</exclude>
<exclude>package.bat</exclude>
<exclude>clean.bat</exclude>
</excludes>
<!--<includes>-->
<!--<include>deploy.bat</include>-->
<!--</includes>-->
</resource> </resource>
</resources> </resources>
@@ -139,6 +123,7 @@
<outputDirectory>${project.build.directory}/final/</outputDirectory> <outputDirectory>${project.build.directory}/final/</outputDirectory>
<appendAssemblyId>false</appendAssemblyId> <appendAssemblyId>false</appendAssemblyId>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>make-assembly</id> <id>make-assembly</id>
+117 -119
View File
@@ -1,6 +1,5 @@
package org.parabot; package org.parabot;
import com.bugsnag.Client;
import org.parabot.core.Configuration; import org.parabot.core.Configuration;
import org.parabot.core.Core; import org.parabot.core.Core;
import org.parabot.core.Directories; import org.parabot.core.Directories;
@@ -11,7 +10,6 @@ import org.parabot.core.network.proxy.ProxyType;
import org.parabot.core.ui.BotUI; import org.parabot.core.ui.BotUI;
import org.parabot.core.ui.ServerSelector; import org.parabot.core.ui.ServerSelector;
import org.parabot.core.ui.utils.UILog; import org.parabot.core.ui.utils.UILog;
import org.parabot.environment.api.utils.JavaUtil;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@@ -27,129 +25,129 @@ import java.net.URI;
* @see <a href="http://www.parabot.org">Homepage</a> * @see <a href="http://www.parabot.org">Homepage</a>
*/ */
public final class Landing { public final class Landing {
private static String username; private static String username;
private static String password; private static String password;
public static void main(String... args) throws IOException {
Core.initiateBugsnagInstance();
parseArgs(args); public static void main(String... args) throws IOException {
Core.verbose("Debug mode: " + Core.inDebugMode()); parseArgs(args);
try { Core.verbose("Debug mode: " + Core.inDebugMode());
Core.verbose("Setting look and feel: "
+ UIManager.getSystemLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Throwable t) {
t.printStackTrace();
}
if (!Core.inDebugMode() && !Core.isValid() && Core.hasValidation()) { try {
UILog.log("Updates", Core.verbose("Setting look and feel: "
"Please download the newest version of Parabot at " + UIManager.getSystemLookAndFeelClassName());
+ Configuration.DOWNLOAD_BOT, UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
JOptionPane.INFORMATION_MESSAGE); } catch (Throwable t) {
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT); t.printStackTrace();
try { }
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Connection Error",
"Error", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
return;
}
Core.verbose("Validating directories..."); if (!Core.inDebugMode() && !Core.isValid() && Core.hasValidation()) {
Directories.validate(); UILog.log("Updates",
Core.verbose("Validating account manager..."); "Please download the newest version of Parabot at "
AccountManager.validate(); + Configuration.DOWNLOAD_BOT,
JOptionPane.INFORMATION_MESSAGE);
URI uri = URI.create(Configuration.API_DOWNLOAD_BOT);
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Connection Error",
"Error", JOptionPane.ERROR_MESSAGE);
e1.printStackTrace();
}
return;
}
if (username != null && password != null) { Core.verbose("Validating directories...");
new BotUI(username, password); Directories.validate();
username = null; Core.verbose("Validating account manager...");
password = null; AccountManager.validate();
return;
}
Core.verbose("Starting login gui..."); if (username != null && password != null) {
new BotUI(null, null); new BotUI(username, password);
} username = null;
password = null;
return;
}
private static void parseArgs(String... args) { Core.verbose("Starting login gui...");
for (int i = 0; i < args.length; i++) { new BotUI(null, null);
final String arg = args[i].toLowerCase(); }
switch (arg.toLowerCase()) {
case "-createdirs": private static void parseArgs(String... args) {
Directories.validate(); for (int i = 0; i < args.length; i++) {
System.out final String arg = args[i].toLowerCase();
.println("Directories created, you can now run parabot."); switch (arg.toLowerCase()) {
System.exit(0); case "-createdirs":
break; Directories.validate();
case "-debug": System.out
Core.setDebug(true); .println("Directories created, you can now run parabot.");
break; System.exit(0);
case "-v": break;
case "-verbose": case "-debug":
Core.setVerbose(true); Core.setDebug(true);
break; break;
case "-server": case "-v":
ServerSelector.initServer = args[++i]; case "-verbose":
break; Core.setVerbose(true);
case "-login": break;
username = args[++i]; case "-server":
password = args[++i]; ServerSelector.initServer = args[++i];
break; break;
case "-loadlocal": case "-login":
Core.setLoadLocal(true); username = args[++i];
break; password = args[++i];
case "-dump": break;
Core.setDump(true); case "-loadlocal":
break; Core.setLoadLocal(true);
case "-scriptsbin": break;
Directories.setScriptCompiledDirectory(new File(args[++i])); case "-dump":
break; Core.setDump(true);
case "-serversbin": break;
Directories.setServerCompiledDirectory(new File(args[++i])); case "-scriptsbin":
break; Directories.setScriptCompiledDirectory(new File(args[++i]));
case "-clearcache": break;
Directories.clearCache(); case "-serversbin":
break; Directories.setServerCompiledDirectory(new File(args[++i]));
case "-mac": break;
byte[] mac = new byte[6]; case "-clearcache":
String str = args[++i]; Directories.clearCache();
if (str.toLowerCase().equals("random")) { break;
new java.util.Random().nextBytes(mac); case "-mac":
} else { byte[] mac = new byte[6];
i--; String str = args[++i];
for (int j = 0; j < 6; j++) { if (str.toLowerCase().equals("random")) {
mac[j] = Byte.parseByte(args[++i], 16); // parses a hex new java.util.Random().nextBytes(mac);
// number } else {
} i--;
} for (int j = 0; j < 6; j++) {
NetworkInterface.setMac(mac); mac[j] = Byte.parseByte(args[++i], 16); // parses a hex
break; // number
case "-proxy": }
ProxyType type = ProxyType.valueOf(args[++i].toUpperCase()); }
if (type == null) { NetworkInterface.setMac(mac);
System.err.println("Invalid proxy type:" + args[i]); break;
System.exit(1); case "-proxy":
return; ProxyType type = ProxyType.valueOf(args[++i].toUpperCase());
} if (type == null) {
ProxySocket.setProxy(type, args[++i], System.err.println("Invalid proxy type:" + args[i]);
Integer.parseInt(args[++i])); System.exit(1);
break; return;
case "-auth": }
ProxySocket.auth = true; ProxySocket.setProxy(type, args[++i],
ProxySocket.setLogin(args[++i], args[++i]); Integer.parseInt(args[++i]));
break; break;
case "-no_sec": case "-auth":
Core.disableSec(); ProxySocket.auth = true;
break; ProxySocket.setLogin(args[++i], args[++i]);
case "-no_validation": break;
Core.disableValidation(); case "-no_sec":
break; Core.disableSec();
} break;
} case "-no_validation":
} Core.disableValidation();
break;
}
}
}
} }
-30
View File
@@ -1,8 +1,5 @@
package org.parabot.core; package org.parabot.core;
import com.bugsnag.BeforeNotify;
import com.bugsnag.Client;
import com.bugsnag.Error;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException; import org.json.simple.parser.ParseException;
import org.parabot.Landing; import org.parabot.Landing;
@@ -39,8 +36,6 @@ public class Core {
private static Version currentVersion = Configuration.BOT_VERSION; private static Version currentVersion = Configuration.BOT_VERSION;
private static Version latestVersion; private static Version latestVersion;
private static Client bugsnagInstance;
public static void disableValidation() { public static void disableValidation() {
Core.validate = false; Core.validate = false;
} }
@@ -286,8 +281,6 @@ public class Core {
Core.verbose("Checking for updates..."); Core.verbose("Checking for updates...");
validateCache(); validateCache();
setBugsnagVersion();
if ((validVersion() && checksumValid()) || (!checksumValid() && currentVersion.compareTo(latestVersion) >= 0)){ if ((validVersion() && checksumValid()) || (!checksumValid() && currentVersion.compareTo(latestVersion) >= 0)){
Core.verbose("No updates available."); Core.verbose("No updates available.");
return true; return true;
@@ -297,29 +290,6 @@ public class Core {
} }
} }
public static void initiateBugsnagInstance() {
bugsnagInstance = new Client(Configuration.BUGSNAG_API);
bugsnagInstance.setSendThreads(true);
}
public static void setBugsnagVersion(){
Core.bugsnagInstance.setReleaseStage(currentVersion != latestVersion ? "development" : "production");
}
public static void setBugsnagUser(String id, String email, String username){
// TODO Check order of parameters
Core.bugsnagInstance.setUser(username, email, id);
}
public static void setBugsnagServer(String server){
Core.setBugsnagInformation("Server", "Server", server);
}
public static void setBugsnagInformation(String tab, String key, String value){
// TODO Should be checked if correct
Core.bugsnagInstance.addToTab(tab, key, value);
}
public static void debug(int i) { public static void debug(int i) {
if(mDebug) { if(mDebug) {
System.out.println("DEBUG: " + i); System.out.println("DEBUG: " + i);
@@ -33,8 +33,6 @@ public class Account {
this.username = username; this.username = username;
this.password = password; this.password = password;
this.api = api; this.api = api;
Core.setBugsnagUser("Null", this.username, "Null");
} }
/** /**
@@ -156,7 +156,6 @@ public class Script implements Runnable {
if(state < 0 || state > 2) { if(state < 0 || state > 2) {
throw new IllegalArgumentException("Illegal state"); throw new IllegalArgumentException("Illegal state");
} }
Core.setBugsnagInformation("Script", "State", String.valueOf(state));
this.state = state; this.state = state;
} }
@@ -181,6 +180,5 @@ public class Script implements Runnable {
public void setScriptID(int scriptID){ public void setScriptID(int scriptID){
this.scriptID = scriptID; this.scriptID = scriptID;
Core.setBugsnagInformation("Script", "State", String.valueOf(scriptID));
} }
} }
@@ -24,8 +24,6 @@ public abstract class ServerExecuter {
@Override @Override
public void run() { public void run() {
try { try {
Core.setBugsnagServer(serverName);
Context context = Context.getInstance(provider); Context context = Context.getInstance(provider);
context.load(); context.load();
PaintComponent.getInstance().startPainting(context); PaintComponent.getInstance().startPainting(context);
+1 -1
View File
@@ -1 +1 @@
application.version=${project.version} application.version=${project.version}${build.version}