From 7c2ec16d1ec98640dcc9e070f2b9361f68df6f02 Mon Sep 17 00:00:00 2001 From: Sean Leonard Date: Wed, 10 Jul 2013 11:24:15 -0600 Subject: Fix ConcurrentModificationException when removing VpnProfile from iterator backing Collection --- src/se/leap/leapclient/EIP.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/se/leap/leapclient/EIP.java b/src/se/leap/leapclient/EIP.java index 426f4359..b86a2a4a 100644 --- a/src/se/leap/leapclient/EIP.java +++ b/src/se/leap/leapclient/EIP.java @@ -302,7 +302,6 @@ public final class EIP extends IntentService { ProfileManager vpl = ProfileManager.getInstance(context); try { - if ( name == "first" ) { name = vpl.getProfiles().iterator().next().mName; } @@ -330,9 +329,11 @@ public final class EIP extends IntentService { // Currently deletes VpnProfile for host, if there already is one, and builds new ProfileManager vpl = ProfileManager.getInstance(context); Collection profiles = vpl.getProfiles(); - for (VpnProfile p : profiles){ + for (Iterator it = profiles.iterator(); it.hasNext(); ){ + VpnProfile p = it.next(); try { if ( p.mName.contains( gateway.getString("host") ) ) + it.remove(); vpl.removeProfile(context, p); } catch (JSONException e) { // TODO Auto-generated catch block -- cgit v1.2.3