Menu

#315 NullPointerException on start up when proxy image not found

0.96.53 DEV
open
nobody
3
2010-06-07
2010-06-07
Jared
No

Whenever the proxy cannot download the "magic_the_gathering.jpg", the loader tries to use "default.jpg" which is not included with the distribution. This results in a null file reference and a NullPointerException.

#Session:552543728;Sun Jun 06 20:33:31 EDT 2010
552543728#[main] DEBUG - ConfigurationUtils.locate(): base is null, name is settings.xml
552543728#[main] DEBUG - Loading configuration from the path settings.xml
552543728#[main] DEBUG - MP v0.95.52, jre:1.6.0_14-b08, jvm:14.0-b16,os:Windows XP, res:1280x800, root:D:\My Workspaces\firemox\firemox\src\main\resources\ 552543728#[main] DEBUG - MP Language : Default
552543728#[main] DEBUG - exportedDamageTypeNames (6)
552543728#[main] FATAL - could not load picture C:\firemox\tbs\mtg\images\magic_the_gathering.jpg from URL http://mi.wizards.com/global/images/magic/general/magic_the_gathering.jpg, mi.wizards.com
552543728#[main] DEBUG - java.lang.RuntimeException: could not load picture C:\firemox\tbs\mtg\images\magic_the_gathering.jpg from URL http://mi.wizards.com/global/images/magic/general/magic_the_gathering.jpg, mi.wizards.com
552543728#[main] DEBUG - java.lang.NullPointerException

Thread [main] (Suspended (exception NullPointerException))
Picture.loadImage(String, URL, MonitoredCheckContent) line: 309
Picture.loadImage(String, URL) line: 284
CardFactory.initPreview() line: 118
Magic(MagicUIComponents).setMdb(String) line: 645
Magic.<init>() line: 224
Magic.main(String[]) line: 522

Discussion

  • Jared

    Jared - 2010-06-07
    • priority: 5 --> 3
     
  • Jared

    Jared - 2010-06-07

    Two ways to solve this:

    1) Include a "/tbs/mtg/images/default.jpg" file
    2) Fix to not send the null

    ### Eclipse Workspace Patch 1.0
    #P firemox
    Index: src/main/java/net/sf/firemox/clickable/target/card/CardFactory.java
    ===================================================================
    --- src/main/java/net/sf/firemox/clickable/target/card/CardFactory.java (revision 3335)
    +++ src/main/java/net/sf/firemox/clickable/target/card/CardFactory.java (working copy)
    @@ -115,8 +115,11 @@
    }
    try {
    if (DatabaseFactory.backImage == null) {
    - DatabaseFactory.backImage = Picture.loadImage(
    - MToolKit.getTbsPicture("default.jpg"), null).getContent();
    + String defaultImagePath = MToolKit.getTbsPicture("default.jpg");
    + if (defaultImagePath != null) {
    + DatabaseFactory.backImage = Picture.loadImage(
    + defaultImagePath, null).getContent();
    + }
    }
    try {
    DatabaseFactory.damageImage = Picture.loadImage(
    @@ -131,8 +134,11 @@
    DatabaseFactory.damageImage = Picture.loadImage(
    MToolKit.getTbsPicture("default.jpg"), null).getContent();
    }
    - DatabaseFactory.scaledBackImage = Picture
    - .getScaledImage(DatabaseFactory.backImage);
    +
    + if (DatabaseFactory.backImage != null) {
    + DatabaseFactory.scaledBackImage = Picture
    + .getScaledImage(DatabaseFactory.backImage);
    + }
    DatabaseFactory.damageScaledImage = Picture
    .getScaledImage(DatabaseFactory.damageImage);
    } catch (Throwable e) {

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.