Skip to content

Commit

Permalink
增加一些异常抛出;
Browse files Browse the repository at this point in the history
预览版1.6.7
  • Loading branch information
herbix committed Jun 20, 2014
1 parent 9c4eeee commit 357d814
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Github推荐我弄个README,我就弄了。
添加了对launcher_profiles.json文件的读取和写入(仅限于正版登录方式)<br>
正版登录如果没有成功,可以从历史记录中选择<br>
修复了更新时可能会等很久的bug(貌似1.5.2版本没有好好修复……)<br>
<br>

历史版本
=============
Expand Down
Binary file modified build/SSASTLauncher.jar
Binary file not shown.
13 changes: 10 additions & 3 deletions src/org/ssast/minecraft/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,14 @@ private void run() {
initListeners();
}

private static void exceptionReport(String str) {
public static void exceptionReport(Throwable t) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
t.printStackTrace(new PrintStream(out));
String str = out.toString();
exceptionReport(str);
}

public static void exceptionReport(String str) {
try {
HttpURLConnection conn = (HttpURLConnection) new URL("http://disqus.com/api/3.0/posts/create.json").openConnection();
conn.setRequestMethod("POST");
Expand All @@ -307,7 +314,7 @@ private static void exceptionReport(String str) {
Map<String, String> params = new HashMap<String, String>();

params.put("thread", "2708772165");
params.put("message", str);
params.put("message", "Version " + VERSION + ":\n" + str);
params.put("api_key", "E8Uh5l5fHZ6gD8U3KycjAIAk46f68Zw7C6eW8WSjZvCLXebZ7p0r1yrYDrLilk2F");
params.put("author_name", "Exception Report");
params.put("author_email", "[email protected]");
Expand Down Expand Up @@ -357,7 +364,7 @@ public void run() {
String str = out.toString();
JOptionPane.showMessageDialog(null, Lang.getString("msg.main.error") + str,
Lang.getString("msg.main.error.title"), JOptionPane.ERROR_MESSAGE);
exceptionReport("Version " + VERSION + ":\n" + str);
exceptionReport(str);
}
}
}
1 change: 1 addition & 0 deletions src/org/ssast/minecraft/Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ void checkUpdate() {

} catch (Exception e) {
e.printStackTrace();
Launcher.exceptionReport(e);
}
}
}
2 changes: 2 additions & 0 deletions src/org/ssast/minecraft/process/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import org.json.JSONObject;
import org.ssast.minecraft.Config;
import org.ssast.minecraft.Launcher;
import org.ssast.minecraft.auth.ServerAuth;
import org.ssast.minecraft.util.Lang;
import org.ssast.minecraft.util.OS;
Expand Down Expand Up @@ -173,6 +174,7 @@ public void start() {

} catch (Exception e) {
e.printStackTrace();
Launcher.exceptionReport(e);
}

}
Expand Down
3 changes: 3 additions & 0 deletions src/org/ssast/minecraft/version/RunnableModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.List;
import org.json.JSONObject;
import org.ssast.minecraft.Config;
import org.ssast.minecraft.Launcher;
import org.ssast.minecraft.download.DownloadCallbackAdapter;
import org.ssast.minecraft.download.Downloadable;
import org.ssast.minecraft.download.Downloader;
Expand Down Expand Up @@ -559,6 +560,7 @@ private boolean tryLoadModuleInfo() {
moduleInfo = new RunnableModuleInfo(new JSONObject(resourceStr));
} catch(Exception e) {
e.printStackTrace();
Launcher.exceptionReport(e);
return false;
}
return true;
Expand All @@ -578,6 +580,7 @@ private boolean tryLoadModuleAssets() {
moduleAssets = new RunnableModuleAssets(new JSONObject(resourceStr), getAssetsIndex());
} catch(Exception e) {
e.printStackTrace();
Launcher.exceptionReport(e);
return false;
}
return true;
Expand Down

0 comments on commit 357d814

Please sign in to comment.