diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-11-23 15:24:23 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2011-11-23 15:24:23 +0000 |
commit | 97c97514d72251932e19c311e7cf933bb37a38fd (patch) | |
tree | 7d02cb462049f453875fe924e376847cf8c9c07c /src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java | |
parent | 4793652a944a90d9e47f98f3a725f4c50a2f3ebd (diff) | |
download | jitsi-97c97514d72251932e19c311e7cf933bb37a38fd.zip jitsi-97c97514d72251932e19c311e7cf933bb37a38fd.tar.gz jitsi-97c97514d72251932e19c311e7cf933bb37a38fd.tar.bz2 |
Fixes possible NullPointerExceptions related to packet logging, resources.
Diffstat (limited to 'src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java')
-rw-r--r-- | src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java index 9169ad8..d02fc46 100644 --- a/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java +++ b/src/net/java/sip/communicator/impl/resources/ResourceManagementServiceImpl.java @@ -644,10 +644,14 @@ public class ResourceManagementServiceImpl } else { - stringResources = languagePack.getResources(locale); + stringResources + = (languagePack == null) + ? null + : languagePack.getResources(locale); } - String resourceString = stringResources.get(key); + String resourceString + = (stringResources == null) ? null : stringResources.get(key); if (resourceString == null) { @@ -735,7 +739,7 @@ public class ResourceManagementServiceImpl */ public String getSettingsString(String key) { - return settingsResources.get(key); + return (settingsResources == null) ? null : settingsResources.get(key); } /** @@ -746,7 +750,7 @@ public class ResourceManagementServiceImpl */ public int getSettingsInt(String key) { - String resourceString = settingsResources.get(key); + String resourceString = getSettingsString(key); if (resourceString == null) { @@ -765,7 +769,7 @@ public class ResourceManagementServiceImpl */ public URL getSettingsURL(String urlKey) { - String path = settingsResources.get(urlKey); + String path = getSettingsString(urlKey); if (path == null || path.length() == 0) { @@ -783,16 +787,7 @@ public class ResourceManagementServiceImpl */ public InputStream getSettingsInputStream(String streamKey) { - String path = settingsResources.get(streamKey); - - if (path == null || path.length() == 0) - { - logger.warn("Missing resource for key: " + streamKey); - return null; - } - - return settingsPack.getClass() - .getClassLoader().getResourceAsStream(path); + return getSettingsInputStream(streamKey, settingsPack.getClass()); } /** @@ -807,7 +802,7 @@ public class ResourceManagementServiceImpl public InputStream getSettingsInputStream( String streamKey, Class<?> resourceClass) { - String path = settingsResources.get(streamKey); + String path = getSettingsString(streamKey); if (path == null || path.length() == 0) { |