printStackTrace to java.util.logging.Logger

The severe method is only used to log severe messages without associated throwable information. If you need to log throwable information then you should use the log method instead:

try {
     data = new GameData.Builder().enemy(enemy).build();
     log.fine("new data object\t\t" + data.getEnemy());
     setChanged();
     notifyObservers(data);
} catch (NullPointerException npe) {
     log.log(Level.SEVERE, npe.getMessage(), npe);
}

Leave a Comment