← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22250: UserSettingDeletionHandler, using iterator

 

------------------------------------------------------------
revno: 22250
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-03-11 08:38:08 +0100
message:
  UserSettingDeletionHandler, using iterator
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.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/user/UserSettingDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.java	2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserSettingDeletionHandler.java	2016-03-11 07:38:08 +0000
@@ -1,5 +1,7 @@
 package org.hisp.dhis.user;
 
+import java.util.Iterator;
+
 /*
  * Copyright (c) 2004-2016, University of Oslo
  * All rights reserved.
@@ -57,8 +59,12 @@
     @Override
     public void deleteUser( User user )
     {
-        for ( UserSetting setting : userSettingService.getUserSettings( user ) )
+        Iterator<UserSetting> settings = userSettingService.getUserSettings( user ).iterator();
+        
+        while ( settings.hasNext() )
         {
+            UserSetting setting = settings.next();
+            settings.remove();
             userSettingService.deleteUserSetting( setting );
         }
     }