From ca669ae54f86dbeea277280690584d9f591c7571 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 18 Feb 2015 07:26:26 +0000
Subject: [PATCH] AutoRefactor: collapse if statements
---
opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java | 60 +++++++++++++++++++++++++++++-------------------------------
1 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java b/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
index 26a340a..bc42504 100644
--- a/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
+++ b/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
@@ -388,35 +388,34 @@
} else {
throw new ServletException("Content-Type does not match SOAP 1.1 or SOAP 1.2");
}
- } else if (headerName.equalsIgnoreCase("authorization")) {
- if (headerVal.startsWith("Basic ")) {
- authenticationInHeader = true;
- String authorization = headerVal.substring(6).trim();
- try {
- String unencoded = new String(Base64.decode(authorization));
- int colon = unencoded.indexOf(':');
- if (colon > 0) {
- if (useHTTPAuthzID)
- {
- connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN);
- connOptions.addSASLProperty(
- "authid=u:" + unencoded.substring(0, colon).trim());
- authenticationIsID = true;
- }
- else
- {
- bindDN = unencoded.substring(0, colon).trim();
- }
- bindPassword = unencoded.substring(colon + 1);
+ } else if (headerName.equalsIgnoreCase("authorization") && headerVal.startsWith("Basic "))
+ {
+ authenticationInHeader = true;
+ String authorization = headerVal.substring(6).trim();
+ try {
+ String unencoded = new String(Base64.decode(authorization));
+ int colon = unencoded.indexOf(':');
+ if (colon > 0) {
+ if (useHTTPAuthzID)
+ {
+ connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN);
+ connOptions.addSASLProperty(
+ "authid=u:" + unencoded.substring(0, colon).trim());
+ authenticationIsID = true;
}
- } catch (ParseException ex) {
- // user/DN:password parsing error
- batchResponses.add(
- createErrorResponse(
- new LDAPException(LDAPResultCode.INVALID_CREDENTIALS,
- LocalizableMessage.raw(ex.getMessage()))));
- break;
+ else
+ {
+ bindDN = unencoded.substring(0, colon).trim();
+ }
+ bindPassword = unencoded.substring(colon + 1);
}
+ } catch (ParseException ex) {
+ // user/DN:password parsing error
+ batchResponses.add(
+ createErrorResponse(
+ new LDAPException(LDAPResultCode.INVALID_CREDENTIALS,
+ LocalizableMessage.raw(ex.getMessage()))));
+ break;
}
}
StringTokenizer tk = new StringTokenizer(headerVal, ",");
@@ -560,10 +559,9 @@
if ( code != LDAPResultCode.SUCCESS
&& code != LDAPResultCode.REFERRAL
&& code != LDAPResultCode.COMPARE_TRUE
- && code != LDAPResultCode.COMPARE_FALSE ) {
- if ( ON_ERROR_EXIT.equals(batchRequest.getOnError()) ) {
- break;
- }
+ && code != LDAPResultCode.COMPARE_FALSE && ON_ERROR_EXIT.equals(batchRequest.getOnError()) )
+ {
+ break;
}
}
}
--
Gitblit v1.10.0