forked from External/mage
Fixed a problem with NPE and match start. Chanes to handling of logging.
This commit is contained in:
parent
f670cb3977
commit
9c1f69983b
4 changed files with 18 additions and 15 deletions
|
|
@ -932,7 +932,11 @@ class MatchesTableModel extends AbstractTableModel {
|
|||
case 4:
|
||||
return matches[arg0].getResult();
|
||||
case 5:
|
||||
return timeFormatter.format(matches[arg0].getStartTime());
|
||||
if (matches[arg0].getStartTime() != null) {
|
||||
return timeFormatter.format(matches[arg0].getStartTime());
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
case 6:
|
||||
if (matches[arg0].getEndTime() != null) {
|
||||
return timeFormatter.format(matches[arg0].getEndTime());
|
||||
|
|
|
|||
|
|
@ -821,19 +821,18 @@ public class TableController {
|
|||
int humanPlayers = 0;
|
||||
int aiPlayers = 0 ;
|
||||
int validHumanPlayers = 0;
|
||||
if (match == null && !(table.getState().equals(TableState.WAITING) ||
|
||||
table.getState().equals(TableState.STARTING) ||
|
||||
table.getState().equals(TableState.READY_TO_START) )) {
|
||||
logger.debug("- Match table with no match:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
// return false;
|
||||
}
|
||||
if (match.isDoneSideboarding()) {
|
||||
if (match.getGame() == null) {
|
||||
// no sideboarding and not active game -> match seems to hang (maybe the Draw bug)
|
||||
logger.debug("- Match with no active game and not in sideboard state:");
|
||||
if (!(table.getState().equals(TableState.WAITING) || table.getState().equals(TableState.STARTING) || table.getState().equals(TableState.READY_TO_START))) {
|
||||
if (match == null) {
|
||||
logger.debug("- Match table with no match:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
// return false;
|
||||
} else {
|
||||
if (match.isDoneSideboarding() && match.getGame() == null) {
|
||||
// no sideboarding and not active game -> match seems to hang (maybe the Draw bug)
|
||||
logger.debug("- Match with no active game and not in sideboard state:");
|
||||
logger.debug("-- matchId:" + match.getId() + " [" + match.getName() + "]");
|
||||
// return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check for active players
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class GameStates implements Serializable {
|
|||
states.remove(states.size() - 1);
|
||||
}
|
||||
// return new Copier<GameState>().uncompressCopy(states.get(index));
|
||||
logger.debug("Rolling back state: " + index);
|
||||
logger.trace("Rolling back state: " + index);
|
||||
return states.get(index);
|
||||
}
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public abstract class MatchImpl implements Match {
|
|||
|
||||
public MatchImpl(MatchOptions options) {
|
||||
this.options = options;
|
||||
startTime = null;
|
||||
this.startTime = new Date(); // to avaoid null pointer exceptions
|
||||
replayAvailable = false;
|
||||
draws = 0;
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ public abstract class MatchImpl implements Match {
|
|||
|
||||
@Override
|
||||
public boolean hasStarted() {
|
||||
return startTime != null;
|
||||
return startedGames > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue