From 2688c8ff6874981449ca991857088efd3f516d79 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 05 Mar 2013 11:34:10 +0000
Subject: [PATCH] Cleanup: use Java 5 foreach
---
opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java b/opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java
index 5434592..3d3727da 100644
--- a/opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java
+++ b/opends/src/snmp/src/org/opends/server/snmp/SNMPClassLoaderProvider.java
@@ -43,7 +43,6 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.Set;
import java.util.SortedSet;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -126,8 +125,6 @@
*/
public void initializeConnectionHandler(
SNMPConnectionHandlerCfg configuration) throws Exception {
-
-
// Keep the connection handler configuration
this.currentConfig = configuration;
@@ -136,7 +133,6 @@
// Initialize the Connection Handler with the given configuration
this.initializeConnectionHandler();
-
}
/**
@@ -149,9 +145,7 @@
*/
public ConfigChangeResult applyConfigurationChange(
SNMPConnectionHandlerCfg configuration) {
-
try {
-
// Register/UnRegister SNMP MBeans
if ((this.registeredSNMPMBeans) &&
(!configuration.isRegisteredMbean())) {
@@ -209,8 +203,6 @@
// private methods
private void initializeConnectionHandler() throws Exception {
-
-
// Compute the connectionHandler name
this.connectionHandlerName = "SNMP Connection Handler " +
this.currentConfig.getListenPort();
@@ -308,9 +300,7 @@
* Finalize.
*/
public void finalizeConnectionHandler() {
-
try {
-
if (this.sentTraps == true) {
// Send a trap when stop
this.snmpAdaptor.snmpV1Trap(
@@ -349,9 +339,7 @@
}
private void unregisterSnmpMBeans() {
- Set objectNames = this.dsMib.getMib().getEntriesObjectNames();
- for (Object objectName : objectNames) {
- ObjectName name = (ObjectName) objectName;
+ for (ObjectName name : this.dsMib.getMib().getEntriesObjectNames()) {
try {
this.server.unregisterMBean(name);
} catch (Exception ex) {
@@ -400,8 +388,7 @@
}
}
- private boolean checkTrapsDestinations(SortedSet destinations) {
-
+ private boolean checkTrapsDestinations(SortedSet<String> destinations) {
// If the traps destinations is empty, the traps have to be sent
// to localhost
if ((destinations == null) || (destinations.isEmpty())) {
@@ -409,10 +396,8 @@
}
boolean found = false;
- for (Object destination : destinations) {
- String dest = null;
+ for (String dest : destinations) {
try {
- dest = (String) destination;
InetAddress addr = InetAddress.getByName(dest);
found = true;
} catch (UnknownHostException ex) {
@@ -422,7 +407,6 @@
}
}
return found;
-
}
}
--
Gitblit v1.10.0