mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-12 21:36:21 -04:00
在因无法读取而移除账户时记录日志
This commit is contained in:
parent
d61006dd67
commit
53cad0e56a
@ -52,6 +52,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.jackhuang.hmcl.util.Lang.tryCast;
|
import static org.jackhuang.hmcl.util.Lang.tryCast;
|
||||||
|
import static org.jackhuang.hmcl.util.Logging.LOG;
|
||||||
|
|
||||||
public class Settings {
|
public class Settings {
|
||||||
public static final Gson GSON = new GsonBuilder()
|
public static final Gson GSON = new GsonBuilder()
|
||||||
@ -84,7 +85,7 @@ public class Settings {
|
|||||||
Map<Object, Object> settings = iterator.next();
|
Map<Object, Object> settings = iterator.next();
|
||||||
AccountFactory<?> factory = Accounts.ACCOUNT_FACTORY.get(tryCast(settings.get("type"), String.class).orElse(""));
|
AccountFactory<?> factory = Accounts.ACCOUNT_FACTORY.get(tryCast(settings.get("type"), String.class).orElse(""));
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
// unrecognized account type, so remove it.
|
LOG.warning("Unrecognized account type, removing: " + settings);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -93,7 +94,7 @@ public class Settings {
|
|||||||
try {
|
try {
|
||||||
account = factory.fromStorage(settings, getProxy());
|
account = factory.fromStorage(settings, getProxy());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// storage is malformed, delete.
|
LOG.log(Level.WARNING, "Malformed account storage, removing: " + settings, e);
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user