mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00: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;
|
||||
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.cards.repository.ExpansionRepository;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.util.ImageHelper;
|
||||
|
@ -51,6 +50,11 @@ public class ManaSymbols {
|
|||
}
|
||||
}
|
||||
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) {
|
||||
File file = new File(getSymbolsPath() + Constants.RESOURCE_PATH_SET + set + "-C.jpg");
|
||||
try {
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -21,6 +22,8 @@ public enum ExpansionRepository {
|
|||
|
||||
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 VERSION_ENTITY_NAME = "expansion";
|
||||
private static final long EXPANSION_DB_VERSION = 3;
|
||||
|
@ -63,6 +66,8 @@ public enum ExpansionRepository {
|
|||
setCodes.add(expansion.getCode());
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
logger.error("Can't get the expansion set codes from database.", ex);
|
||||
return setCodes;
|
||||
}
|
||||
return setCodes;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue