diff options
author | Jiri Vanek <[email protected]> | 2012-12-21 18:02:50 +0100 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2012-12-21 18:02:50 +0100 |
commit | e488267b497481d2fbd0ef3e7430e32024741fe5 (patch) | |
tree | 26d8120f8adc52a23e3d2afd3c0902390aa46af6 /netx/net/sourceforge/jnlp/splashscreen/parts | |
parent | 77d66397adaec6704b0c3961b3c9e5e2ba733712 (diff) |
Minor fix for possible NPE (non fatal) during splashscreen creation
Diffstat (limited to 'netx/net/sourceforge/jnlp/splashscreen/parts')
-rw-r--r-- | netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java b/netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java index 9e5101a..01e2655 100644 --- a/netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java +++ b/netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java @@ -44,6 +44,7 @@ import java.util.Collections; import java.util.List; import net.sourceforge.jnlp.InformationDesc; import net.sourceforge.jnlp.JNLPFile; +import net.sourceforge.jnlp.runtime.Translator; /** * This class is wrapper arround <information> tag which should @@ -193,12 +194,31 @@ public class InformationElement { } public static InformationElement createFromJNLP(JNLPFile file) { - if (file == null) { - return null; - } try { + if (file == null) { + String message = Translator.R(InfoItem.SPLASH + "errorInInformation"); + InformationElement ie = new InformationElement(); + ie.setHomepage(""); + ie.setTitle(message); + ie.setvendor(""); + ie.addDescription(message); + return ie; + } + if (file.getInformation() == null) { + String message = Translator.R(InfoItem.SPLASH + "missingInformation"); + InformationElement ie = new InformationElement(); + ie.setHomepage(""); + ie.setTitle(message); + ie.setvendor(""); + ie.addDescription(message); + return ie; + } InformationElement ie = new InformationElement(); - ie.setHomepage(file.getInformation().getHomepage().toString()); + String homePage = Translator.R(InfoItem.SPLASH + "defaultHomepage"); + if (file.getInformation().getHomepage() != null) { + homePage = file.getInformation().getHomepage().toString(); + } + ie.setHomepage(homePage); ie.setTitle(file.getInformation().getTitle()); ie.setvendor(file.getInformation().getVendor()); ie.addDescription(file.getInformation().getDescriptionStrict((String) (InformationDesc.DEFAULT))); @@ -208,7 +228,13 @@ public class InformationElement { return ie; } catch (Exception ex) { ex.printStackTrace(); - return null; + String message = Translator.R(InfoItem.SPLASH + "errorInInformation"); + InformationElement ie = new InformationElement(); + ie.setHomepage(""); + ie.setTitle(message); + ie.setvendor(""); + ie.addDescription(ex.getMessage()); + return ie; } } } |