mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
server logging for nulls
This commit is contained in:
parent
bee12d709c
commit
ad0dde4501
2 changed files with 18 additions and 2 deletions
|
@ -40,6 +40,7 @@ import mage.abilities.mana.ManaAbility;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.util.ThreadLocalStringBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -48,6 +49,8 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
*/
|
||||
public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Abilities<T> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AbilitiesImpl.class);
|
||||
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
|
||||
public AbilitiesImpl() {
|
||||
|
@ -102,9 +105,13 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
|||
rules.add(sbRule.toString());
|
||||
}
|
||||
String rule = ability.getRule();
|
||||
if (rule != null && rule.length() > 0) {
|
||||
if (rule != null) {
|
||||
if (rule.length() > 0) {
|
||||
rules.add(Character.toUpperCase(rule.charAt(0)) + rule.substring(1));
|
||||
}
|
||||
} else { // logging so we can still can be made aware of rule problems a card has
|
||||
logger.fatal("Error in rule text generation of " + source + ": Create a bug report or fix the source code");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ import mage.target.Target;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -58,6 +59,8 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class AwakenAbility extends SpellAbility {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AwakenAbility.class);
|
||||
|
||||
static private String filterMessage = "a land you control to awake";
|
||||
|
||||
private String rule;
|
||||
|
@ -135,6 +138,12 @@ public class AwakenAbility extends SpellAbility {
|
|||
effect.setTargetPointer(fixedTarget);
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
} else { // source should never be null, but we are seeing a lot of NPEs from this section
|
||||
if (source == null) {
|
||||
logger.fatal("Source was null in AwakenAbility: Create a bug report or fix the source code");
|
||||
} else if (source.getTargets() == null) {
|
||||
logger.fatal("getTargets was null in AwakenAbility for " + source + " : Create a bug report or fix the source code");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue