Source:
<code>public synchronized void onConnectionOpened(URI resource) { try { Notifications notifications = new Notifications(); notifications.enabled = Arrays.asList(new Notification[] {}); notifications.disabled = Arrays.asList(new Notification[] {}); if (av_content_socket.getURI().equals(resource)) { notifications = getSwitches(av_content_socket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyPlayingContentInfo")) { notifications.enabled.add(a); <START> iter.remove(); <END> } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); av_content_socket.callMethod(switchNotifications); } if (audio_socket.getURI().equals(resource)) { notifications = getSwitches(audio_socket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyVolumeInformation")) { notifications.enabled.add(a); iter.remove(); } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); audio_socket.callMethod(switchNotifications); } if (system_socket.getURI().equals(resource)) { notifications = getSwitches(system_socket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyPowerStatus")) { notifications.enabled.add(a); iter.remove(); } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); system_socket.callMethod(switchNotifications); } listener.updateConnectionState(true); } catch (IOException e) { listener.updateConnectionState(false); } }</code><technical_language>handle NumberParsingExceptions here</technical_language>

Target:
public synchronized void onConnectionOpened(URI resource) { try { Notifications notifications = new Notifications(); notifications.enabled = Arrays.asList(new Notification[] {}); notifications.disabled = Arrays.asList(new Notification[] {}); if (avContentSocket.getURI().equals(resource)) { notifications = getSwitches(avContentSocket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyPlayingContentInfo")) { notifications.enabled.add(a); iter.remove(); } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); avContentSocket.callMethod(switchNotifications); } if (audioSocket.getURI().equals(resource)) { notifications = getSwitches(audioSocket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyVolumeInformation")) { notifications.enabled.add(a); iter.remove(); } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); audioSocket.callMethod(switchNotifications); } if (systemSocket.getURI().equals(resource)) { notifications = getSwitches(systemSocket, notifications); for (Iterator<Notification> iter = notifications.disabled.listIterator(); iter.hasNext();) { Notification a = iter.next(); if (a.name.equalsIgnoreCase("notifyPowerStatus")) { notifications.enabled.add(a); iter.remove(); } } SwitchNotifications switchNotifications = new SwitchNotifications(notifications.enabled, notifications.disabled); systemSocket.callMethod(switchNotifications); } listener.updateConnectionState(true); } catch (IOException e) { logger.error("Failed to setup connection"); listener.updateConnectionState(false); } }