diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/resources/Messages.properties | 3 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties | 3 | ||||
-rw-r--r-- | netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java | 36 |
4 files changed, 47 insertions, 5 deletions
@@ -1,3 +1,13 @@ +2012-12-21 Jiri Vanek <[email protected]> + + Minor fix for possible NPE (non fatal) during splashscreen creation + * netx/net/sourceforge/jnlp/resources/Messages.properties: + * netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties: + Added messages for user (SPLASHdefaultHomepage) + (SPLASHerrorInInformation)(SPLASHmissingInformation). + * netx/net/sourceforge/jnlp/splashscreen/parts/InformationElement.java + (createFromJNLP) catch of NPE replaced by conditions with proper messages. + 2012-12-21 Jiri Vanek <[email protected]> Forgotten condition for AviationWeather first run: diff --git a/netx/net/sourceforge/jnlp/resources/Messages.properties b/netx/net/sourceforge/jnlp/resources/Messages.properties index 1fde3d3..b4ef709 100644 --- a/netx/net/sourceforge/jnlp/resources/Messages.properties +++ b/netx/net/sourceforge/jnlp/resources/Messages.properties @@ -470,3 +470,6 @@ SPLASHexWas = Exception was: SPLASHcfl = Can't follow link to
SPLASHvendorsInfo = Information from vendor of your application
SPLASHanotherInfo = Another available info
+SPLASHdefaultHomepage = Unspecified homepage, verify source rather
+SPLASHerrorInInformation = Error during loading of information element, verify source rather
+SPLASHmissingInformation = Information element is missing, verify source rather
diff --git a/netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties b/netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties index 9663e19..db23eff 100644 --- a/netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties +++ b/netx/net/sourceforge/jnlp/resources/Messages_cs_CZ.properties @@ -466,3 +466,6 @@ SPLASHexWas= Zaznamenan\u00e1 v\u00fdjimka: SPLASHcfl= Nelze \u010d\u00edst odkaz SPLASHvendorsInfo= Informace od dodavatele va\u0161\u00ed aplikace SPLASHanotherInfo= Dal\u0161\u00ed dostupn\u00e9 informace +SPLASHdefaultHomepage = Nespecifikovan\u00e1 domovsk\u00e1 st\u00e1nka, je doporu\u010deno zkontrolovat zdroj +SPLASHerrorInInformation = Chyba na\u010d\u00edt\u00e1n\u00ed informa\u010dn\u00edho elementu, je doporu\u010deno zkontrolovat zdroj +SPLASHmissingInformation = Informa\u010dn\u00ed element chyb\u00fd, je doporu\u010deno zkontrolovat zdroj
\ No newline at end of file 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; } } } |