From d313f559a1f70e4372b71647caa457bfbdf793a6 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 09 Jul 2013 10:28:15 +0000
Subject: [PATCH] Remove try / catch / throw anti-pattern

---
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java   |   81 ++++-----------
 opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfileStackFrame.java                          |   14 +-
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java           |   30 -----
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java        |   21 +---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java                  |    5 
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java                |    4 
 opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java |  136 ++++++---------------------
 7 files changed, 70 insertions(+), 221 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 27eb4aa..422856a 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -86,6 +86,7 @@
    * Actually performs the install in this thread.  The thread is blocked.
    *
    */
+  @Override
   public void run()
   {
     runError = null;
@@ -147,10 +148,6 @@
         {
           new ServerController(this).startServer(!isStartVerbose());
         }
-        catch (ApplicationException ae)
-        {
-          throw ae;
-        }
         finally
         {
           if (!isStartVerbose())
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index bdaa453..c2f8109 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -193,10 +193,6 @@
         {
           new ServerController(this).startServer(!isStartVerbose());
         }
-        catch (ApplicationException ae)
-        {
-          throw ae;
-        }
         finally
         {
           if (!isVerbose())
diff --git a/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfileStackFrame.java b/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfileStackFrame.java
index fb9016c..2375bcf 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfileStackFrame.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/plugins/profiler/ProfileStackFrame.java
@@ -292,6 +292,7 @@
    *
    * @return  The hash code for this stack frame.
    */
+  @Override
   public int hashCode()
   {
     return (className.hashCode() + methodName.hashCode());
@@ -309,6 +310,7 @@
    * @return  <CODE>true</CODE> if the provided object may be considered equal
    *          to this stack frame, or <CODE>false</CODE> if not.
    */
+  @Override
   public boolean equals(Object o)
   {
     if (o == null)
@@ -354,18 +356,11 @@
    * @throws  ClassCastException  If the provided object is not a profile stack
    *                              frame.
    */
+  @Override
   public int compareTo(Object o)
          throws ClassCastException
   {
-    ProfileStackFrame f;
-    try
-    {
-      f = (ProfileStackFrame) o;
-    }
-    catch (ClassCastException cce)
-    {
-      throw cce;
-    }
+    ProfileStackFrame f = (ProfileStackFrame) o;
 
     long thisCount = getTotalCount();
     long thatCount = f.getTotalCount();
@@ -395,6 +390,7 @@
    *
    * @return  A string representation of this stack frame.
    */
+  @Override
   public String toString()
   {
     StringBuilder buffer = new StringBuilder();
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java
index ce3563f..a5b18bc 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/AciTests.java
@@ -83,6 +83,7 @@
  * they are built by buildAciValue, so that we are less likely to screw up
  * the syntax.
  */
+@SuppressWarnings("javadoc")
 @Test(sequential=true, groups="slow")
 public class AciTests extends AciTestCase {
 // TODO: test modify use cases
@@ -1826,14 +1827,12 @@
         SingleSearchParams.nonProxiedSearch(ADMIN_DN, ADMIN_PW, LEVEL_3_USER_DN,
                       OBJECTCLASS_STAR, SCOPE_BASE,
                       null, null, null);
-      try {
+      {
           addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
           modEntries(COMPARE_ACI, DIR_MGR_DN, DIR_MGR_PW);
           String userResults =
                   ldapCompare(adminParam.getLdapCompareArgs("cn:level3 user"));
           Assert.assertFalse(userResults.equals(""));
-      } catch(Throwable e) {
-          throw e;
       }
   }
 
@@ -1865,7 +1864,7 @@
                                      "pa$$word",PROXY_USER_DN, SALES_USER_NEW_1,
                                       OBJECTCLASS_STAR, SCOPE_BASE,
                                       null, null, null);
-    try {
+    {
       addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
       modEntries(ACI_PROXY_IMPORT_MGR, DIR_MGR_DN, DIR_MGR_PW);
       modEntries(ACI_PROXY_CONTROL_LEVEL_1, DIR_MGR_DN, DIR_MGR_PW);
@@ -1885,8 +1884,6 @@
       modEntries(modrdnLdif1, LEVEL_1_USER_DN, "pa$$word", PROXY_USER_DN);
       String userOrigResults = ldapSearch(userParamOrig.getLdapSearchArgs());
       Assert.assertFalse(userOrigResults.equals(""));
-    } catch (Throwable e)  {
-      throw e;
     }
   }
 
@@ -1909,7 +1906,7 @@
                                       null, null, null);
 
 
-     try {
+    {
         addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
         modEntries(ACI_IMPORT_MGR, DIR_MGR_DN, DIR_MGR_PW);
         modEntries(ACI_IMPORT_MGR_NEW, DIR_MGR_DN, DIR_MGR_PW);
@@ -1927,9 +1924,7 @@
         modEntries(modrdnLdif1, LEVEL_1_USER_DN, "pa$$word");
         String userOrigResults = ldapSearch(userParamOrig.getLdapSearchArgs());
         Assert.assertFalse(userOrigResults.equals(""));
-   } catch (Throwable e)  {
-       throw e;
-   }
+    }
   }
 
   /**
@@ -1950,14 +1945,10 @@
    */
   @Test()
   public void testNonSelfWrite() throws Throwable {
-          try {
-            addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
-            modEntries(SELFWRITE_ACI, DIR_MGR_DN, DIR_MGR_PW);
-            deleteAttrFromEntry(OU_GROUP_1_DN, "member",LEVEL_1_USER_DN,
-                                LEVEL_3_USER_DN, "pa$$word",  false);
-          } catch(Throwable e) {
-                throw e;
-          }
+    addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
+    modEntries(SELFWRITE_ACI, DIR_MGR_DN, DIR_MGR_PW);
+    deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
+        LEVEL_3_USER_DN, "pa$$word", false);
   }
 
   /**
@@ -1967,14 +1958,10 @@
    */
   @Test()
   public void testSelfWrite() throws Throwable {
-          try {
-            addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
-            modEntries(SELFWRITE_ACI, DIR_MGR_DN, DIR_MGR_PW);
-            deleteAttrFromEntry(OU_GROUP_1_DN, "member",LEVEL_1_USER_DN,
-                                LEVEL_1_USER_DN, "pa$$word",  true);
-          } catch(Throwable e) {
-                throw e;
-          }
+    addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
+    modEntries(SELFWRITE_ACI, DIR_MGR_DN, DIR_MGR_PW);
+    deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
+        LEVEL_1_USER_DN, "pa$$word", true);
   }
 
   /**
@@ -1982,27 +1969,23 @@
    * @throws Throwable  If the search doesn't return any entries.
    */
   @Test()
-   public void testDNSWildCard()  throws Throwable {
+  public void testDNSWildCard() throws Throwable {
         SingleSearchParams userParam =
           SingleSearchParams.nonProxiedSearch(LEVEL_1_USER_DN,
                                    "pa$$word", LEVEL_3_USER_DN,
                                    OBJECTCLASS_STAR, SCOPE_BASE,
                                    null, null, null);
-        try {
+        {
             addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
             modEntries(DNS_ALL_ACI, DIR_MGR_DN, DIR_MGR_PW);
             String userResults = ldapSearch(userParam.getLdapSearchArgs());
             Assert.assertFalse(userResults.equals(""));
-        } catch(Throwable e) {
-                throw e;
         }
- }
+  }
 
 
   /**
    * Test group  bind rule ACI keywords.
-   *
-   * @throws Throwable
    */
  @Test()
  public void testGroupAcis()  throws Throwable {
@@ -2017,15 +2000,13 @@
                                      "pa$$word", LEVEL_3_USER_DN,
                                      OBJECTCLASS_STAR, SCOPE_BASE,
                                      null, null, null);
-        try {
+        {
             addEntries(BASIC_LDIF__GROUP_SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
             modEntries(GROUP1_GROUPDN_MODS, DIR_MGR_DN, DIR_MGR_PW);
             String userResults = ldapSearch(userParam.getLdapSearchArgs());
             Assert.assertFalse(userResults.equals(""));
             String adminResults = ldapSearch(adminParam.getLdapSearchArgs());
             Assert.assertTrue(adminResults.equals(""));
-        } catch(Throwable e) {
-                throw e;
         }
  }
 
@@ -2046,7 +2027,7 @@
                                      "pa$$word", OU_BASE_DN,
                                      OBJECTCLASS_STAR, SCOPE_BASE,
                                      null, null, null);
-      try {
+
         addEntries(BASIC_LDIF__SEARCH_TESTS, DIR_MGR_DN, DIR_MGR_PW);
         modEntries(GLOBAL_MODS, DIR_MGR_DN, DIR_MGR_PW);
         String monitorResults = ldapSearch(monitorParam.getLdapSearchArgs());
@@ -2058,10 +2039,7 @@
         Assert.assertTrue(monitorResults.equals(""));
         baseResults = ldapSearch(baseParam.getLdapSearchArgs());
         Assert.assertTrue(baseResults.equals(""));
-      } catch (Throwable e) {
-           throw e;
-       }
- }
+  }
 
   @Test(dataProvider = "searchTestParams")
   public void testSearchWithAcis(SingleSearchParams params) throws Throwable {
@@ -2180,7 +2158,7 @@
             "pa$$word", OU_BASE_DN,
             OBJECTCLASS_STAR, SCOPE_BASE,
             null, null, null);
-    try {
+
       String monitorResults = ldapSearch(monitorParam.getLdapSearchArgs());
       Assert.assertFalse(monitorResults.equals(""));
       String baseResults = ldapSearch(baseParam.getLdapSearchArgs());
@@ -2190,27 +2168,16 @@
       Assert.assertTrue(monitorResults.equals(""));
       baseResults = ldapSearch(baseParam.getLdapSearchArgs());
       Assert.assertTrue(baseResults.equals(""));
-    } catch (Throwable e) {
-      throw e;
-    }
 
     // Test selfwrite right. Attempt to bind as level3 user and remove
     // level1 user from a group, should fail.
-    try {
-      deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
-              LEVEL_3_USER_DN, "pa$$word", false);
-    } catch (Throwable e) {
-      throw e;
-    }
+    deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
+        LEVEL_3_USER_DN, "pa$$word", false);
 
     // Test selfwrite right. Attempt to bind as level1 user and remove
     // itself from a group, should succeed.
-    try {
-      deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
-              LEVEL_1_USER_DN, "pa$$word", true);
-    } catch (Throwable e) {
-      throw e;
-    }
+    deleteAttrFromEntry(OU_GROUP_1_DN, "member", LEVEL_1_USER_DN,
+        LEVEL_1_USER_DN, "pa$$word", true);
   }
 
 
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
index 72c3c19..c97c422 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/jeb/TestBackendImpl.java
@@ -56,6 +56,7 @@
 /**
  * BackendImpl Tester.
  */
+@SuppressWarnings("javadoc")
 public class TestBackendImpl extends JebTestCase {
   private String homeDirName;
 
@@ -1692,22 +1693,10 @@
     ResultCode success      = ResultCode.SUCCESS;
     ResultCode noSuchObject = ResultCode.NO_SUCH_OBJECT;
 
-    DN testComDN            = null;
-    DN peopleTestComDN      = null;
-    DN dummyTestComDN       = null;
-    DN dummyPeopleTestComDN = null;
-
-    try
-    {
-      testComDN            = DN.decode(                   "dc=test,dc=com");
-      dummyTestComDN       = DN.decode(          "cn=dummy,dc=test,dc=com");
-      peopleTestComDN      = DN.decode(         "ou=people,dc=test,dc=com");
-      dummyPeopleTestComDN = DN.decode("cn=dummy,ou=people,dc=test,dc=com");
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
+    DN testComDN            = DN.decode(                   "dc=test,dc=com");
+    DN peopleTestComDN      = DN.decode(          "cn=dummy,dc=test,dc=com");
+    DN dummyTestComDN       = DN.decode(         "ou=people,dc=test,dc=com");
+    DN dummyPeopleTestComDN = DN.decode("cn=dummy,ou=people,dc=test,dc=com");
 
     // Sets of DNs
     Object[][] myData =
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
index ebb759e..e8b49f0 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/WorkflowTopologyTest.java
@@ -99,22 +99,10 @@
   public Object[][] initDNSet_1()
     throws Exception
   {
-    DN dnNull         = null;
-    DN baseDN1        = null;
-    DN subordinateDN1 = null;
-    DN unrelatedDN    = null;
-
-    try
-    {
-      dnNull         = DN.decode ("");
-      baseDN1        = DN.decode ("o=test");
-      subordinateDN1 = DN.decode ("ou=subtest,o=test");
-      unrelatedDN    = DN.decode ("o=dummy");
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
+    DN dnNull         = DN.decode ("");
+    DN baseDN1        = DN.decode ("o=test");
+    DN subordinateDN1 = DN.decode ("ou=subtest,o=test");
+    DN unrelatedDN    = DN.decode ("o=dummy");
 
     // Sets of DNs
     Object[][] myData =
@@ -194,7 +182,6 @@
     //           |              |
     //           |              |
     //    ou=subordinate3
-    try
     {
       String suffix         = "ou=test1";
       String baseDN1        = suffix;
@@ -217,10 +204,6 @@
       unrelatedDN = DN.decode ("o=dummy");
       rootDSE     = DN.decode ("");
     }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
 
     // Sets of DNs
     Object[][] myData =
@@ -289,7 +272,6 @@
     //                          |                 |
     //                          |                 |
     //                   ou=subordinate2   ou=subordinate3
-    try
     {
       String suffix         = "dc=example,dc=com";
       String baseDN1        = suffix;
@@ -312,10 +294,6 @@
       unrelatedDN = DN.decode ("o=dummy");
       rootDSE     = DN.decode ("");
     }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
 
     // Sets of DNs
     Object[][] myData =
diff --git a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
index 9d4584d..4d314a5 100644
--- a/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
+++ b/opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/networkgroups/NetworkGroupTest.java
@@ -28,35 +28,21 @@
 package org.opends.server.core.networkgroups;
 
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.opends.server.config.ConfigConstants.DN_BACKEND_BASE;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.testng.Assert.*;
 
 import java.util.ArrayList;
 import java.util.Collections;
 
-import static org.opends.messages.CoreMessages.*;
-
-import org.opends.server.TestCaseUtils;
 import org.opends.server.DirectoryServerTestCase;
+import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.std.meta.NetworkGroupCfgDefn.AllowedAuthMethod;
 import org.opends.server.api.ClientConnection;
 import org.opends.server.core.*;
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.protocols.ldap.LDAPFilter;
-import org.opends.server.types.Attribute;
-import org.opends.server.types.Attributes;
-import org.opends.server.types.AuthenticationInfo;
-import org.opends.server.types.ByteString;
-import org.opends.server.types.DN;
-import org.opends.server.types.DirectoryException;
-import org.opends.server.types.Entry;
-import org.opends.server.types.InitializationException;
-import org.opends.server.types.Modification;
-import org.opends.server.types.ModificationType;
-import org.opends.server.types.ResultCode;
-import org.opends.server.types.SearchScope;
+import org.opends.server.types.*;
 import org.opends.server.workflowelement.WorkflowElement;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
@@ -110,17 +96,8 @@
     String networkGroupID2 = "networkGroup2";
 
     // Workflow base DNs
-    DN dn1 = null;
-    DN dn2 = null;
-    try
-    {
-      dn1 = DN.decode("o=test1");
-      dn2 = DN.decode("o=test2");
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
+    DN dn1 = DN.decode("o=test1");
+    DN dn2 = DN.decode("o=test2");
 
     // Network group info
     Object[][] myData =
@@ -160,41 +137,21 @@
   public Object[][] initDNSet_1()
     throws Exception
   {
-    DN dnRootDSE = null;
-    DN dnConfig  = null;
-    DN dnMonitor = null;
-    DN dnSchema  = null;
-    DN dnTasks   = null;
-    DN dnBackups = null;
-    DN dnDummy   = null;
+    DN dnRootDSE = DN.decode("");
+    DN dnConfig  = DN.decode("cn=config");
+    DN dnMonitor = DN.decode("cn=monitor");
+    DN dnSchema  = DN.decode("cn=schema");
+    DN dnTasks   = DN.decode("cn=tasks");
+    DN dnBackups = DN.decode("cn=backups");
+    DN dnDummy   = DN.decode("o=dummy_suffix");
 
-    DN dnSubordinateConfig  = null;
-    DN dnSubordinateMonitor = null;
-    DN dnSubordinateTasks   = null;
-
-    try
-    {
-      dnRootDSE = DN.decode("");
-      dnConfig  = DN.decode("cn=config");
-      dnMonitor = DN.decode("cn=monitor");
-      dnSchema  = DN.decode("cn=schema");
-      dnTasks   = DN.decode("cn=tasks");
-      dnBackups = DN.decode("cn=backups");
-      dnDummy   = DN.decode("o=dummy_suffix");
-
-      dnSubordinateConfig  = DN.decode("cn=Work Queue,cn=config");
-      dnSubordinateMonitor = DN.decode("cn=schema Backend,cn=monitor");
-      dnSubordinateTasks   = DN.decode("cn=Scheduled Tasks,cn=tasks");
-
-      // No DN subordinate for schema because the schema backend is
-      // currently empty.
-      // No DN subordinate for cn=backups because by default there is no
-      // child entry under cn=backups.
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
+    DN dnSubordinateConfig  = DN.decode("cn=Work Queue,cn=config");
+    DN dnSubordinateMonitor = DN.decode("cn=schema Backend,cn=monitor");
+    DN dnSubordinateTasks   = DN.decode("cn=Scheduled Tasks,cn=tasks");
+    // No DN subordinate for schema because the schema backend is
+    // currently empty.
+    // No DN subordinate for cn=backups because by default there is no
+    // child entry under cn=backups.
 
     // Sets of DNs
     Object[][] myData =
@@ -232,27 +189,13 @@
     throws Exception
   {
     // Network group definition
-    DN     dn1          = null;
-    DN     dn2          = null;
-    DN     dn3          = null;
-    DN     subordinate1 = null;
-    DN     subordinate2 = null;
-    DN     subordinate3 = null;
-    DN     unrelatedDN  = null;
-    try
-    {
-      dn1          = DN.decode("o=test1");
-      dn2          = DN.decode("o=test2");
-      dn3          = DN.decode("o=test3");
-      subordinate1 = DN.decode("ou=subtest1,o=test1");
-      subordinate2 = DN.decode("ou=subtest2,o=test2");
-      subordinate3 = DN.decode("ou=subtest3,o=test3");
-      unrelatedDN  = DN.decode("o=dummy");
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
+    DN     dn1          = DN.decode("o=test1");
+    DN     dn2          = DN.decode("o=test2");
+    DN     dn3          = DN.decode("o=test3");
+    DN     subordinate1 = DN.decode("ou=subtest1,o=test1");
+    DN     subordinate2 = DN.decode("ou=subtest2,o=test2");
+    DN     subordinate3 = DN.decode("ou=subtest3,o=test3");
+    DN     unrelatedDN  = DN.decode("o=dummy");
 
     // Network group info
     Object[][] myData =
@@ -302,7 +245,7 @@
   {
     // Network group definition
     String networkGroupID = "networkGroup1";
-    DN  dn = null;
+    DN  dn = DN.decode("o=test1");
     int prio = 1;
 
     // Resource limits
@@ -314,15 +257,6 @@
     int searchSizeLimit = 50;
     int minSubstringLength = 4;
 
-    try
-    {
-      dn = DN.decode("o=test1");
-    }
-    catch (DirectoryException de)
-    {
-      throw de;
-    }
-
     // Network group info
     Object[][] myData =
     {
@@ -353,15 +287,9 @@
   {
     String networkGroupID1 = "group1";
     String networkGroupID2 = "group2";
-    DN dn1 = null;
-    DN dn2 = null;
+    DN dn1 = DN.decode("o=test1");
+    DN dn2 = DN.decode("o=test2");
 
-    try {
-      dn1 = DN.decode("o=test1");
-      dn2 = DN.decode("o=test2");
-    } catch (DirectoryException de) {
-      throw de;
-    }
     Object[][] myData = {
       {
         networkGroupID1,
@@ -1115,8 +1043,6 @@
     networkGroup.register();
     networkGroup.setConnectionCriteria(secCriteria);
 
-    NetworkGroup defaultNg = NetworkGroup.getDefaultNetworkGroup();
-
     // Create a new client connection, with anonymous authentication
     // It should match the secured group as internal connections
     // are secured

--
Gitblit v1.10.0