From e8cead474d5ce2b933d931f0c4743a78e68d9cfc Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 18 Aug 2015 09:39:52 +0000
Subject: [PATCH] Replaced uses of StringBuilder.append(Utils.joinAsString(String, Collection)) with the more efficient Utils.joinAsString(StringBuilder, String, Collection).
---
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java | 74 +++++-------------------------------
1 files changed, 11 insertions(+), 63 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
index d71c53e..7c57c7c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/ExtendedResponseProtocolOp.java
@@ -26,17 +26,16 @@
*/
package org.opends.server.protocols.ldap;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
import java.io.IOException;
+import java.util.List;
-import org.forgerock.opendj.io.*;
-import org.opends.server.types.DN;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.util.Utils;
+import org.opends.server.types.DN;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.ServerConstants.*;
@@ -55,13 +54,10 @@
/** The matched DN for this response. */
private DN matchedDN;
-
/** The result code for this response. */
private int resultCode;
-
/** The set of referral URLs for this response. */
private List<String> referralURLs;
-
/** The error message for this response. */
private LocalizableMessage errorMessage;
@@ -78,12 +74,6 @@
public ExtendedResponseProtocolOp(int resultCode)
{
this.resultCode = resultCode;
-
- errorMessage = null;
- matchedDN = null;
- referralURLs = null;
- oid = null;
- value = null;
}
@@ -99,11 +89,6 @@
{
this.resultCode = resultCode;
this.errorMessage = errorMessage;
-
- matchedDN = null;
- referralURLs = null;
- oid = null;
- value = null;
}
@@ -123,9 +108,6 @@
this.errorMessage = errorMessage;
this.matchedDN = matchedDN;
this.referralURLs = referralURLs;
-
- oid = null;
- value = null;
}
@@ -228,36 +210,19 @@
return value;
}
-
-
- /**
- * Retrieves the BER type for this protocol op.
- *
- * @return The BER type for this protocol op.
- */
+ @Override
public byte getType()
{
return OP_TYPE_EXTENDED_RESPONSE;
}
-
-
- /**
- * Retrieves the name for this protocol op type.
- *
- * @return The name for this protocol op type.
- */
+ @Override
public String getProtocolOpName()
{
return "Extended Response";
}
- /**
- * Writes this protocol op to an ASN.1 output stream.
- *
- * @param stream The ASN.1 output stream to write to.
- * @throws IOException If a problem occurs while writing to the stream.
- */
+ @Override
public void write(ASN1Writer stream) throws IOException
{
stream.writeStartSequence(OP_TYPE_EXTENDED_RESPONSE);
@@ -304,14 +269,7 @@
stream.writeEndSequence();
}
-
-
- /**
- * Appends a string representation of this LDAP protocol op to the provided
- * buffer.
- *
- * @param buffer The buffer to which the string should be appended.
- */
+ @Override
public void toString(StringBuilder buffer)
{
buffer.append("ExtendedResponse(resultCode=");
@@ -330,7 +288,7 @@
if (referralURLs != null && !referralURLs.isEmpty())
{
buffer.append(", referralURLs={");
- buffer.append(Utils.joinAsString(", ", referralURLs));
+ Utils.joinAsString(buffer, ", ", referralURLs);
buffer.append("}");
}
if (oid != null && oid.length() > 0)
@@ -347,16 +305,7 @@
buffer.append(")");
}
-
-
- /**
- * Appends a multi-line string representation of this LDAP protocol op to the
- * provided buffer.
- *
- * @param buffer The buffer to which the information should be appended.
- * @param indent The number of spaces from the margin that the lines should
- * be indented.
- */
+ @Override
public void toString(StringBuilder buffer, int indent)
{
StringBuilder indentBuf = new StringBuilder(indent);
@@ -422,4 +371,3 @@
}
}
}
-
--
Gitblit v1.10.0