why does the ui crash

This commit is contained in:
huangyuhui committed 2015-12-27 10:59:03 +08:00
1 parent b1c6c3549f
commit 07357db42d
536 files changed
+1562 -776

No files matched your search

View File
File mode changed.
View File
File mode changed.
File mode changed.
+3 -3
View File
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -28,9 +28,9 @@ import org.jackhuang.hellominecraft.logging.layout.DefaultLayout;
*/
public class Configuration {
public ArrayList<IAppender> appenders = new ArrayList<IAppender>();
public ArrayList<IAppender> appenders = new ArrayList<>();
public static Configuration DEFAULT;
public static final Configuration DEFAULT;
static {
DEFAULT = new Configuration();
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -27,11 +27,11 @@ import org.jackhuang.hellominecraft.logging.LogEvent;
*/
public class DefaultLayout extends AbstractStringLayout {
private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
private static final SimpleDateFormat SDF = new SimpleDateFormat("HH:mm:ss");
@Override
public String toSerializable(LogEvent event) {
return "[" + sdf.format(new Date()) + "] [" + event.threadName + "/" + event.level.name() + "] " + event.message.getFormattedMessage() + "\n";
return "[" + SDF.format(new Date()) + "] [" + event.threadName + "/" + event.level.name() + "] " + event.message.getFormattedMessage() + "\n";
}
}
File mode changed.
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.logging.message.ParameterizedMessageFactory;
import org.jackhuang.hellominecraft.logging.message.StringFormattedMessage;
public abstract class AbstractLogger
implements ILogger {
implements ILogger {
public static final Class<? extends IMessageFactory> DEFAULT_MESSAGE_FACTORY_CLASS = ParameterizedMessageFactory.class;
@@ -52,9 +52,7 @@ implements ILogger {
private IMessageFactory createDefaultMessageFactory() {
try {
return (IMessageFactory) DEFAULT_MESSAGE_FACTORY_CLASS.newInstance();
} catch (InstantiationException e) {
throw new IllegalStateException(e);
} catch (IllegalAccessException e) {
} catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException(e);
}
}
File mode changed.
+6 -2
View File
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -38,8 +38,12 @@ public class Logger extends AbstractLogger {
}
public Logger(String name, IMessageFactory messageFactory, Level defaultLevel) {
this(name, Configuration.DEFAULT, messageFactory, defaultLevel);
}
public Logger(String name, Configuration config, IMessageFactory messageFactory, Level defaultLevel) {
super(name, messageFactory);
this.config = new PrivateConfig(Configuration.DEFAULT, this, defaultLevel);
this.config = new PrivateConfig(config, this, defaultLevel);
}
public synchronized void setLevel(Level level) {
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -85,14 +85,14 @@ public class SimpleLogger extends AbstractLogger {
dateText = this.dateFormatter.format(now);
}
sb.append(dateText);
sb.append(' ');
sb.append(SPACE);
}
sb.append(level.toString());
sb.append(' ');
sb.append(SPACE);
if ((this.logName != null) && (this.logName.length() > 0)) {
sb.append(this.logName);
sb.append(' ');
sb.append(SPACE);
}
sb.append(msg.getFormattedMessage());
Object[] params = msg.getParameters();
@@ -102,7 +102,7 @@ public class SimpleLogger extends AbstractLogger {
else
t = throwable;
if (t != null) {
sb.append(' ');
sb.append(SPACE);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
t.printStackTrace(new PrintStream(baos));
sb.append(baos.toString());
File mode changed.
File mode changed.
File mode changed.
File mode changed.
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -31,7 +31,7 @@ import java.util.Set;
* @author huangyuhui
*/
public class ParameterizedMessage
implements IMessage {
implements IMessage {
public static final String RECURSION_PREFIX = "[...";
public static final String RECURSION_SUFFIX = "...]";
@@ -203,19 +203,23 @@ implements IMessage {
boolean isEscaped = false;
for (int i = 0; i < messagePattern.length(); i++) {
char curChar = messagePattern.charAt(i);
if (curChar == ESCAPE_CHAR)
switch (curChar) {
case ESCAPE_CHAR:
isEscaped = !isEscaped;
else if (curChar == DELIM_START) {
break;
case DELIM_START:
if ((!isEscaped)
&& (i < messagePattern.length() - 1)
&& (messagePattern.charAt(i + 1) == DELIM_STOP)) {
result++;
i++;
}
isEscaped = false;
} else
break;
default:
isEscaped = false;
break;
}
}
return result;
}
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
+9 -1
View File
@@ -48,6 +48,7 @@ public class TaskWindow extends javax.swing.JDialog
private TaskList taskList;
private final ArrayList<String> failReasons = new ArrayList();
private String stackTrace = null, lastStackTrace = null;
/**
* Creates new form DownloadWindow
@@ -91,7 +92,11 @@ public class TaskWindow extends javax.swing.JDialog
try {
taskList.start();
} catch (Exception e) {
HMCLog.warn("Failed to start thread, maybe there're already a taskwindow here.", e);
HMCLog.err("Failed to start thread, maybe there're already a taskwindow here.", e);
HMCLog.err("There's the stacktrace of the this invoking.");
HMCLog.err(stackTrace);
HMCLog.err("There's the stacktrace of the last invoking.");
HMCLog.err(lastStackTrace);
MessageBox.Show(C.i18n("taskwindow.no_more_instance"));
return false;
}
@@ -300,6 +305,7 @@ public class TaskWindow extends javax.swing.JDialog
}
public boolean start() {
String stacktrace = StrUtils.getStackTrace(new Throwable());
return SwingUtils.invokeAndWait(() -> {
synchronized (INSTANCE) {
if (INSTANCE.isVisible())
@@ -307,6 +313,8 @@ public class TaskWindow extends javax.swing.JDialog
TaskWindow tw = inst();
for (Task t : ll)
tw.addTask(t);
tw.lastStackTrace = tw.stackTrace;
tw.stackTrace = stacktrace;
return tw.start();
}
});
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
+17 -1
View File
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -18,6 +18,7 @@
package org.jackhuang.hellominecraft.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -121,4 +122,19 @@ public class ArrayUtils {
}
return -1;
}
public static <T> boolean equals(T[] a, T[] b) {
if (a == null && b == null)
return true;
if (a == null || b == null)
return false;
if (a.length != b.length)
return false;
Arrays.sort(a);
Arrays.sort(b);
for (int i = 0; i < a.length; i++)
if (a[i] == null && b[i] != null || a[i] != null && b[i] == null || !a[i].equals(b[i]))
return false;
return true;
}
}
File mode changed.
File mode changed.
View File
File mode changed.
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
File mode changed.
File mode changed.
File mode changed.
+11 -7
View File
@@ -1,7 +1,7 @@
/*
* Hello Minecraft! Launcher.
* Copyright (C) 2013 huangyuhui <[email protected]>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -95,12 +95,12 @@ public class MessageBox {
*/
public static int Show(String Msg, String Title, int Option) {
switch (Option) {
case YES_NO_OPTION:
case YES_NO_CANCEL_OPTION:
case OK_CANCEL_OPTION:
return SwingUtils.invokeAndWait(() -> JOptionPane.showConfirmDialog(null, Msg, Title, Option - 10));
default:
SwingUtils.invokeAndWait(() -> JOptionPane.showMessageDialog(null, Msg, Title, Option));
case YES_NO_OPTION:
case YES_NO_CANCEL_OPTION:
case OK_CANCEL_OPTION:
return SwingUtils.invokeAndWait(() -> JOptionPane.showConfirmDialog(null, Msg, Title, Option - 10));
default:
SwingUtils.invokeAndWait(() -> JOptionPane.showMessageDialog(null, Msg, Title, Option));
}
return 0;
}
@@ -127,4 +127,8 @@ public class MessageBox {
public static int Show(String Msg) {
return Show(Msg, TITLE, INFORMATION_MESSAGE);
}
public static int ShowLocalized(String msg) {
return Show(C.i18n(msg));
}
}
View File
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
File mode changed.
View File
File mode changed.
View File
File mode changed.
File mode changed.
File mode changed.
Loaded 100 of 536 files, more files were not shown because too many files have changed in this diff. Show more