← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22109: Fix null pointer exception in translated system settings

 

------------------------------------------------------------
revno: 22109
committer: Nicolay Ramm <nicolayr@xxxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-03-02 16:38:08 +0100
message:
  Fix null pointer exception in translated system settings
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java	2016-03-02 15:38:08 +0000
@@ -59,10 +59,10 @@
     {
         Map<String, String> translations = new Hashtable<>();
 
-        translations.put( SettingKey.APPLICATION_TITLE.getDefaultValue().toString(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_TITLE.getDefaultValue().toString(), localeStr, SettingKey.APPLICATION_TITLE.getDefaultValue().toString() ) );        
-        translations.put( SettingKey.APPLICATION_INTRO.getDefaultValue().toString(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_INTRO.getDefaultValue().toString(), localeStr, "" ) );
-        translations.put( SettingKey.APPLICATION_NOTIFICATION.getDefaultValue().toString(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_NOTIFICATION.getDefaultValue().toString(), localeStr, "" ) );
-        translations.put( SettingKey.APPLICATION_FOOTER.getDefaultValue().toString(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_FOOTER.getDefaultValue().toString(), localeStr, "" ) );
+        translations.put( SettingKey.APPLICATION_TITLE.getName(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_TITLE.getName(), localeStr, SettingKey.APPLICATION_TITLE.getDefaultValue().toString() ) );
+        translations.put( SettingKey.APPLICATION_INTRO.getName(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_INTRO.getName(), localeStr, "" ) );
+        translations.put( SettingKey.APPLICATION_NOTIFICATION.getName(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_NOTIFICATION.getName(), localeStr, "" ) );
+        translations.put( SettingKey.APPLICATION_FOOTER.getName(), getSystemSettingWithFallbacks( SettingKey.APPLICATION_FOOTER.getName(), localeStr, "" ) );
                 
         return translations;
     }
@@ -72,14 +72,14 @@
     {
         Map<String, String> translations = new Hashtable<>();
 
-        translations.put( SettingKey.APPLICATION_TITLE.getDefaultValue().toString(), ObjectUtils.firstNonNull( 
-            systemSettingManager.getSystemSetting( SettingKey.APPLICATION_TITLE.getDefaultValue().toString() + localeStr ), SettingKey.APPLICATION_TITLE.getDefaultValue().toString() ).toString() );        
-        translations.put( SettingKey.APPLICATION_INTRO.getDefaultValue().toString(), ObjectUtils.firstNonNull( 
-            systemSettingManager.getSystemSetting( SettingKey.APPLICATION_INTRO.getDefaultValue().toString() + localeStr ), "" ).toString() );
-        translations.put( SettingKey.APPLICATION_NOTIFICATION.getDefaultValue().toString(), ObjectUtils.firstNonNull( 
-            systemSettingManager.getSystemSetting( SettingKey.APPLICATION_NOTIFICATION.getDefaultValue().toString() + localeStr ), "" ).toString() );
-        translations.put( SettingKey.APPLICATION_FOOTER.getDefaultValue().toString(), ObjectUtils.firstNonNull( 
-            systemSettingManager.getSystemSetting( SettingKey.APPLICATION_FOOTER.getDefaultValue().toString() + localeStr ), "" ).toString() );
+        translations.put( SettingKey.APPLICATION_TITLE.getName(), ObjectUtils.firstNonNull(
+                systemSettingManager.getSystemSetting(SettingKey.APPLICATION_TITLE.getName() + localeStr), SettingKey.APPLICATION_TITLE.getDefaultValue(), "" ).toString() );
+        translations.put( SettingKey.APPLICATION_INTRO.getName(), ObjectUtils.firstNonNull(
+                systemSettingManager.getSystemSetting( SettingKey.APPLICATION_INTRO.getName() + localeStr ), "" ).toString() );
+        translations.put( SettingKey.APPLICATION_NOTIFICATION.getName(), ObjectUtils.firstNonNull(
+                systemSettingManager.getSystemSetting( SettingKey.APPLICATION_NOTIFICATION.getName() + localeStr ), "" ).toString() );
+        translations.put( SettingKey.APPLICATION_FOOTER.getName(), ObjectUtils.firstNonNull(
+                systemSettingManager.getSystemSetting( SettingKey.APPLICATION_FOOTER.getName() + localeStr ), "" ).toString() );
                 
         return translations;
     }