add debug information.

This commit is contained in:
huanghongxun 2015-11-22 17:50:00 +08:00
parent 2dede7dea1
commit c76b0e0ffb
9 changed files with 36 additions and 12 deletions

View File

@ -124,16 +124,16 @@ public final class Launcher {
final String advice = MinecraftCrashAdvicer.getAdvice(trace);
MessageBox.Show(C.i18n("crash.minecraft") + ": " + advice);
LogWindow.instance.setExit(TrueFunction.instance);
System.err.println(C.i18n("crash.minecraft"));
System.err.println(advice);
System.err.println(trace);
LogWindow.instance.setExit(TrueFunction.instance);
LogWindow.instance.setVisible(true);
flag = 1;
}
println("*** Game Exited ***");
System.exit(flag);
Utils.shutdownForcely(1);
}
static Object getShutdownHaltLock() {

View File

@ -72,6 +72,7 @@ public class GameLauncher {
}
public IMinecraftLoader makeLaunchCommand() {
HMCLog.log("Logging in...");
IMinecraftLoader loader;
try {
if (info != null)
@ -98,10 +99,13 @@ public class GameLauncher {
if (file != null)
FileUtils.cleanDirectoryQuietly(file);
HMCLog.log("Detecting libraries...");
if (!downloadLibrariesEvent.execute(provider.getDownloadLibraries(downloadType))) {
failEvent.execute(C.i18n("launch.failed"));
return null;
}
HMCLog.log("Unpacking natives...");
if (!decompressNativesEvent.execute(provider.getDecompressLibraries())) {
failEvent.execute(C.i18n("launch.failed"));
return null;
@ -152,6 +156,7 @@ public class GameLauncher {
* @throws java.io.IOException write contents failed.
*/
public File makeLauncher(String launcherName, List str) throws IOException {
HMCLog.log("Making shell launcher...");
provider.onLaunch();
boolean isWin = OS.os() == OS.WINDOWS;
File f = new File(launcherName + (isWin ? ".bat" : ".sh"));

View File

@ -12,6 +12,7 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.HMCLog;
import org.jackhuang.hellominecraft.utils.NetUtils;
import org.jackhuang.hellominecraft.utils.StrUtils;
@ -122,8 +123,13 @@ public class YggdrasilAuthentication {
String jsonResult = input == null ? NetUtils.get(url) : NetUtils.post(url, GSON.toJson(input), "application/json", proxy);
Response response = (Response) GSON.fromJson(jsonResult, Response.class);
if (StrUtils.isNotBlank(response.error))
if (StrUtils.isNotBlank(response.error)) {
HMCLog.err("Failed to log in, the auth server returned an error: " + response.error + ", message: " + response.errorMessage + ", cause: " + response.cause);
if (response.errorMessage.contains("Invalid token")) {
response.errorMessage = C.i18n("login.invalid_token");
}
throw new AuthenticationException("Request error: " + response.errorMessage);
}
if (!clientToken.equals(response.clientToken))
throw new AuthenticationException(C.i18n("login.changed_client_token"));

View File

@ -105,17 +105,18 @@ public final class NetUtils {
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.setConnectTimeout(15000);
con.setReadTimeout(15000);
con.setConnectTimeout(30000);
con.setReadTimeout(30000);
con.setRequestProperty("Content-Type", contentType + "; charset=utf-8");
con.setRequestProperty("Content-Length", "" + post.getBytes(DEFAULT_CHARSET).length);
byte[] bytes = post.getBytes(DEFAULT_CHARSET);
con.setRequestProperty("Content-Length", "" + bytes.length);
con.connect();
OutputStream os = null;
try {
os = con.getOutputStream();
IOUtils.write(post, os, DEFAULT_CHARSET);
IOUtils.write(bytes, os);
} finally {
if (os != null)
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(os);
}
String result;
@ -124,8 +125,7 @@ public final class NetUtils {
is = con.getInputStream();
result = getStreamContent(is);
} catch (IOException ex) {
if (is != null)
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(is);
is = con.getErrorStream();
result = getStreamContent(is);
}

View File

@ -16,6 +16,7 @@
*/
package org.jackhuang.hellominecraft.views;
import java.awt.Frame;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.SimpleAttributeSet;
@ -197,7 +198,15 @@ public class LogWindow extends javax.swing.JFrame {
}// </editor-fold>//GEN-END:initComponents
private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCloseActionPerformed
this.dispose();
boolean flag = false;
for (Frame f : Frame.getFrames()) {
if (f == this) continue;
if (f.isVisible()) flag = true;
}
if (flag)
this.dispose();
else
Utils.shutdownForcely(0);
}//GEN-LAST:event_btnCloseActionPerformed
private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClearActionPerformed

View File

@ -75,6 +75,7 @@ login.not_email=\u7528\u6237\u540d\u5fc5\u987b\u662f\u90ae\u7bb1
login.type=\u767b\u5f55
login.username=\u540d\u5b57
login.account=\u90ae\u7bb1
login.invalid_token=\u8bf7\u5c1d\u8bd5\u767b\u51fa\u5e76\u91cd\u65b0\u8f93\u5165\u5bc6\u7801\u767b\u5f55
login.no_valid_character=\u65e0\u6709\u6548\u7684\u89d2\u8272\uff0c\u81ea\u884c\u5230skinme.cc\u767b\u9646\u5e76\u521b\u5efa\u89d2\u8272
proxy.username=\u8d26\u6237

View File

@ -75,6 +75,7 @@ login.not_email=The username must be a e-mail.
login.type=Login
login.username=Name
login.account=Email
login.invalid_token=Please log out and reinput your password to log in.
login.no_valid_character=No Valid Character, please visit skinme.cc and create your own character.
proxy.username=Account

View File

@ -75,6 +75,7 @@ login.not_email=\u7528\u6237\u540d\u5fc5\u987b\u662f\u90ae\u7bb1
login.type=\u767b\u5f55
login.username=\u540d\u5b57
login.account=\u90ae\u7bb1
login.invalid_token=\u8bf7\u5c1d\u8bd5\u767b\u51fa\u5e76\u91cd\u65b0\u8f93\u5165\u5bc6\u7801\u767b\u5f55
login.no_valid_character=\u65e0\u6709\u6548\u7684\u89d2\u8272\uff0c\u81ea\u884c\u5230skinme.cc\u767b\u9646\u5e76\u521b\u5efa\u89d2\u8272
proxy.username=\u8d26\u6237

View File

@ -75,6 +75,7 @@ login.not_email=\u7528\u6236\u540d\u5fc5\u9808\u662f\u90f5\u7bb1
login.type=\u767b\u9304
login.username=\u540d\u5b57
login.account=\u90ae\u7bb1
login.invalid_token=\u8acb\u5617\u8a66\u767b\u51fa\u4e26\u91cd\u65b0\u8f38\u5165\u5bc6\u78bc\u767b\u9304
login.no_valid_character=\u7121\u6709\u6548\u7684\u89d2\u8272\uff0c\u81ea\u884c\u5230skinme.cc\u767b\u9678\u4e26\u5275\u5efa\u89d2\u8272
proxy.username=\u8d26\u6236