opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -52,6 +52,7 @@ import org.opends.server.tools.ClientException; import org.opends.server.tools.ToolConstants; import org.opends.server.tools.dsconfig.LDAPManagementContextFactory; import org.opends.server.util.StaticUtils; import org.opends.server.util.args.ArgumentException; import org.opends.server.util.cli.CLIException; import org.opends.server.util.cli.ConsoleApplication; @@ -1031,10 +1032,7 @@ } finally { try { reader.close(); } catch (Exception e) {} StaticUtils.close(reader); } } /** opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -34,7 +34,7 @@ import org.forgerock.i18n.LocalizableMessageBuilder; import static org.opends.server.tools.ToolConstants.*; import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; import static org.opends.server.util.StaticUtils.wrapText; import static org.opends.server.util.StaticUtils.*; import java.io.File; import java.io.FileInputStream; @@ -858,14 +858,7 @@ } finally { if (fos != null) { try { fos.close(); } catch (Exception e) {} } close(fos); } } trustManager = new ApplicationTrustManager(truststore); @@ -942,13 +935,7 @@ } finally { if (fos != null) { try { fos.close(); } catch (Exception e) {} } close(fos); } char[] password = null; opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java
@@ -1287,14 +1287,7 @@ } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e){} } close(inputStream); } @@ -1352,14 +1345,7 @@ } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e){} } close(inputStream); } @@ -1425,14 +1411,7 @@ } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e){} } close(inputStream); } try opendj3-server-dev/src/server/org/opends/server/extensions/DictionaryPasswordValidator.java
@@ -226,13 +226,7 @@ } finally { if (reader != null) { try { reader.close(); } catch (Exception e) {} } close(reader); } return dictionary; opendj3-server-dev/src/server/org/opends/server/extensions/FileBasedKeyManagerProvider.java
@@ -403,10 +403,7 @@ } finally { try { br.close(); } catch (Exception e) {} close(br); } if (pinStr == null) @@ -561,10 +558,7 @@ } finally { try { br.close(); } catch (Exception e) {} close(br); } if (pinStr == null) opendj3-server-dev/src/server/org/opends/server/extensions/FileBasedTrustManagerProvider.java
@@ -205,10 +205,7 @@ } finally { try { br.close(); } catch (Exception e) {} close(br); } if (pinStr == null) @@ -437,10 +434,7 @@ } finally { try { br.close(); } catch (Exception e) {} close(br); } if (pinStr == null) @@ -562,10 +556,7 @@ } finally { try { br.close(); } catch (Exception e) {} close(br); } if (pinStr == null) opendj3-server-dev/src/server/org/opends/server/plugins/profiler/ProfileViewer.java
@@ -288,10 +288,7 @@ } finally { try { reader.close(); } catch (Exception e) {} close(reader); } } opendj3-server-dev/src/server/org/opends/server/protocols/LDIFConnectionHandler.java
@@ -504,21 +504,7 @@ } finally { if (reader != null) { try { reader.close(); } catch (Exception e) {} } if (writer != null) { try { writer.close(); } catch (Exception e) {} } close(reader, writer); } if (errorEncountered || (! fullyProcessed)) opendj3-server-dev/src/server/org/opends/server/tools/LDAPReader.java
@@ -27,22 +27,25 @@ package org.opends.server.tools; import org.opends.server.protocols.asn1.*; import java.io.Closeable; import java.io.IOException; import java.net.Socket; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Exception; import org.opends.server.protocols.asn1.ASN1Reader; import org.opends.server.protocols.ldap.LDAPMessage; import org.opends.server.types.LDAPException; import org.opends.server.types.RecordingInputStream; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.server.util.ServerConstants; import java.io.IOException; import java.net.Socket; /** * This class defines a utility that can be used to read LDAP messages from a * provided socket. */ public class LDAPReader public class LDAPReader implements Closeable { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); @@ -118,6 +121,7 @@ /** * Closes this LDAP reader and the underlying socket. */ @Override public void close() { try opendj3-server-dev/src/server/org/opends/server/tools/LDAPWriter.java
@@ -27,28 +27,29 @@ package org.opends.server.tools; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.ldap.LDAPMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.server.types.RecordingOutputStream; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.util.ServerConstants; import java.net.Socket; import java.io.IOException; import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.IOException; import java.net.Socket; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.protocols.asn1.ASN1; import org.opends.server.protocols.asn1.ASN1Writer; import org.opends.server.protocols.ldap.LDAPMessage; import org.opends.server.types.RecordingOutputStream; import org.opends.server.util.ServerConstants; /** * This class defines a utility that can be used to write LDAP messages over a * provided socket. */ public class LDAPWriter public class LDAPWriter implements Closeable { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); Socket socket; ASN1Writer asn1Writer; private Socket socket; private ASN1Writer asn1Writer; private RecordingOutputStream debugOutputStream; @@ -110,6 +111,7 @@ /** * Closes this LDAP writer and the underlying socket. */ @Override public void close() { try opendj3-server-dev/src/server/org/opends/server/tools/LDIFModify.java
@@ -645,20 +645,7 @@ successful = false; } try { sourceReader.close(); } catch (Exception e) {} try { changeReader.close(); } catch (Exception e) {} try { targetWriter.close(); } catch (Exception e) {} close(sourceReader, changeReader, targetWriter); for (LocalizableMessage s : errorList) { opendj3-server-dev/src/server/org/opends/server/tools/LDIFSearch.java
@@ -844,18 +844,7 @@ } } // Close the reader and writer. try { reader.close(); } catch (Exception e) {} try { writer.close(); } catch (Exception e) {} close(reader, writer); return resultCode; } opendj3-server-dev/src/server/org/opends/server/tools/makeldif/MakeLDIF.java
@@ -376,10 +376,7 @@ } finally { try { ldifWriter.close(); } catch (Exception e) {} close(ldifWriter); } opendj3-server-dev/src/server/org/opends/server/types/LDIFImportConfig.java
@@ -36,6 +36,7 @@ import org.opends.server.tools.makeldif.MakeLDIFInputStream; import org.opends.server.tools.makeldif.TemplateFile; import org.opends.server.util.StaticUtils; import org.forgerock.i18n.slf4j.LocalizedLogger; import static org.opends.messages.UtilityMessages.*; @@ -478,11 +479,7 @@ { if (rejectWriter != null) { try { rejectWriter.close(); } catch (Exception e) {} StaticUtils.close(rejectWriter); rejectWriter = null; } @@ -533,11 +530,7 @@ { if (rejectWriter != null) { try { rejectWriter.close(); } catch (Exception e) {} StaticUtils.close(rejectWriter); rejectWriter = null; } @@ -570,10 +563,7 @@ { if (skipWriter != null) { try { skipWriter.close(); } catch (Exception e) {} StaticUtils.close(skipWriter); skipWriter = null; } @@ -625,10 +615,7 @@ { if (skipWriter != null) { try { skipWriter.close(); } catch (Exception e) {} StaticUtils.close(skipWriter); skipWriter = null; } opendj3-server-dev/src/server/org/opends/server/util/args/FileBasedArgument.java
@@ -225,10 +225,7 @@ } finally { try { reader.close(); } catch (Exception e) {} close(reader); } opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/DeleteOperationTestCase.java
@@ -967,10 +967,7 @@ break responseLoop; default: // This is a problem. It's an unexpected response. try { s.close(); } catch (Exception e) {} StaticUtils.close(s); throw new Exception("Unexpected response message " + message + " encountered in " + opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/IdleTimeLimitTestCase.java
@@ -37,6 +37,7 @@ import org.forgerock.opendj.ldap.ByteString; import org.opends.server.protocols.ldap.*; import org.opends.server.tools.LDAPWriter; import org.opends.server.util.StaticUtils; import static org.testng.Assert.*; @@ -95,10 +96,7 @@ } finally { try { s.close(); } catch (Exception e) {} StaticUtils.close(s); TestCaseUtils.dsconfig( "set-global-configuration-prop", @@ -168,10 +166,7 @@ } finally { try { s.close(); } catch (Exception e) {} StaticUtils.close(s); TestCaseUtils.dsconfig( "set-global-configuration-prop", @@ -237,10 +232,7 @@ } finally { try { s.close(); } catch (Exception e) {} StaticUtils.close(s); } } } opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
@@ -44,6 +44,7 @@ import org.opends.server.types.*; import org.forgerock.opendj.ldap.ByteString; import org.opends.server.util.Base64; import org.opends.server.util.StaticUtils; import org.testng.annotations.*; import static org.testng.Assert.*; @@ -53,13 +54,13 @@ */ public class LDAPBinaryOptionTestCase extends LdapTestCase { // Exported LDIF file. File ldif = null; private File ldif = null; //LDIFExportConfig used for exporting entries. LDIFExportConfig exportConfig = null; private LDIFExportConfig exportConfig = null; //LDIFImportConfig used for importing entries. LDIFImportConfig importConfig = null; private LDIFImportConfig importConfig = null; //Test Backend. Backend backend = null; private Backend backend = null; //Constant value of userCertificate attribute. private static final String CERT= @@ -366,20 +367,9 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/protocols/ldap/LDAPv2TestCase.java
@@ -37,6 +37,7 @@ import org.opends.server.TestCaseUtils; import org.opends.server.tools.LDAPWriter; import org.opends.server.types.*; import org.opends.server.util.StaticUtils; import org.forgerock.opendj.ldap.ByteString; import static org.testng.Assert.*; @@ -108,18 +109,8 @@ "replace: ds-cfg-allow-ldap-v2", "ds-cfg-allow-ldap-v2: true"); try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -161,18 +152,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -223,18 +204,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -271,18 +242,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -331,18 +292,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -390,18 +341,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -453,18 +394,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -513,18 +444,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } @@ -574,18 +495,8 @@ } finally { try { r.close(); } catch (Exception e) {} try { w.close(); } catch (Exception e) {} try { s.close(); } catch (Exception e) {} StaticUtils.close(r, w); StaticUtils.close(s); } } } opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tasks/DisconnectClientTaskTestCase.java
@@ -40,6 +40,7 @@ import org.opends.server.extensions.GetConnectionIDExtendedOperation; import org.opends.server.protocols.ldap.*; import org.opends.server.types.DN; import org.opends.server.util.StaticUtils; import org.forgerock.opendj.ldap.ByteString; import static org.testng.Assert.*; @@ -139,10 +140,7 @@ LDAPConstants.OID_NOTICE_OF_DISCONNECTION); assertEquals(extendedResponse.getErrorMessage(), disconnectMessage); try { s.close(); } catch (Exception e) {} StaticUtils.close(s); } @@ -212,10 +210,7 @@ // disconnection. assertNull(r.readMessage()); try { s.close(); } catch (Exception e) {} StaticUtils.close(s); } }