mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
Added some error handling client startup.
This commit is contained in:
parent
b096379881
commit
a3dba9b1d0
2 changed files with 11 additions and 2 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
package org.mage.card.arcane;
|
package org.mage.card.arcane;
|
||||||
|
|
||||||
import mage.cards.repository.CardRepository;
|
|
||||||
import mage.cards.repository.ExpansionRepository;
|
import mage.cards.repository.ExpansionRepository;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
import mage.client.util.ImageHelper;
|
import mage.client.util.ImageHelper;
|
||||||
|
|
@ -51,6 +50,11 @@ public class ManaSymbols {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
List<String> setCodes = ExpansionRepository.instance.getSetCodes();
|
||||||
|
if (setCodes == null) {
|
||||||
|
// the cards db file is probaly not included in the client. It will be created after the first connect to a server.
|
||||||
|
log.warn("No db information for sets found. Connect to a server to create database file on client side. Then try to restart the client.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (String set : setCodes) {
|
for (String set : setCodes) {
|
||||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-C.jpg");
|
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-C.jpg");
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -21,6 +22,8 @@ public enum ExpansionRepository {
|
||||||
|
|
||||||
instance;
|
instance;
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(ExpansionRepository.class);
|
||||||
|
|
||||||
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2;AUTO_SERVER=TRUE";
|
private static final String JDBC_URL = "jdbc:h2:file:./db/cards.h2;AUTO_SERVER=TRUE";
|
||||||
private static final String VERSION_ENTITY_NAME = "expansion";
|
private static final String VERSION_ENTITY_NAME = "expansion";
|
||||||
private static final long EXPANSION_DB_VERSION = 3;
|
private static final long EXPANSION_DB_VERSION = 3;
|
||||||
|
|
@ -63,6 +66,8 @@ public enum ExpansionRepository {
|
||||||
setCodes.add(expansion.getCode());
|
setCodes.add(expansion.getCode());
|
||||||
}
|
}
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
|
logger.error("Can't get the expansion set codes from database.", ex);
|
||||||
|
return setCodes;
|
||||||
}
|
}
|
||||||
return setCodes;
|
return setCodes;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue