← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16232: Fixed nullpointer vulnerability in I18nService

 

------------------------------------------------------------
revno: 16232
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-07-25 09:51:46 +0200
message:
  Fixed nullpointer vulnerability in I18nService
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.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/i18n/DefaultI18nService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2014-07-18 11:44:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2014-07-25 07:51:46 +0000
@@ -279,7 +279,6 @@
      * Returns a map representing Translations for an object matching the given
      * id where the key is the translation property and the value is the
      * translation value.
-     * 
      *
      * @param translations Collection to search.
      * @param objectUid
@@ -289,11 +288,14 @@
     {
         Collection<Translation> objectTranslations = new ArrayList<Translation>();
 
-        for ( Translation translation : translations )
+        if ( objectUid != null )
         {
-            if (translation.getObjectUid().equals( objectUid ))
+            for ( Translation translation : translations )
             {
-                objectTranslations.add( translation );
+                if ( objectUid.equals( translation.getObjectUid() ) )
+                {
+                    objectTranslations.add( translation );
+                }
             }
         }