From 772c28c6950e41b76e1a4b262114881b9f7390c5 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 22 Oct 2014 08:28:40 +0000
Subject: [PATCH] AutoRefactored: Collapsed if statements and inverted equals().
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
index 03c19d6..f58e61c 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -316,7 +316,7 @@
final StringTokenizer lineTokenizer = new StringTokenizer(text, "\r\n", true);
while (lineTokenizer.hasMoreTokens()) {
final String line = lineTokenizer.nextToken();
- if (line.equals("\r") || line.equals("\n")) {
+ if ("\r".equals(line) || "\n".equals(line)) {
// It's an end-of-line character, so append it as-is.
buffer.append(line);
} else if (line.length() <= width) {
@@ -331,7 +331,7 @@
final StringTokenizer wordTokenizer = new StringTokenizer(line, " ", true);
while (wordTokenizer.hasMoreTokens()) {
final String word = wordTokenizer.nextToken();
- if (word.equals(" ")) {
+ if (" ".equals(word)) {
// It's a space, so add it to the delim buffer only
// if the line buffer is not empty.
if (lineBuffer.length() > 0) {
@@ -351,8 +351,7 @@
if (wordTokenizer.hasMoreTokens()) {
// The next token must be a space, so remove it.
- // If there are still more tokens after that, then append an
- // EOL.
+ // If there are still more tokens after that, then append an EOL.
wordTokenizer.nextToken();
if (wordTokenizer.hasMoreTokens()) {
buffer.append(EOL);
@@ -448,14 +447,13 @@
* trying to establish a connection and <CODE>false</CODE> otherwise.
*/
public static boolean isCertificateException(Throwable t) {
- boolean returnValue = false;
-
- while (!returnValue && t != null) {
- returnValue = t instanceof SSLHandshakeException || t instanceof GeneralSecurityException;
+ while (t != null) {
+ if (t instanceof SSLHandshakeException || t instanceof GeneralSecurityException) {
+ return true;
+ }
t = t.getCause();
}
-
- return returnValue;
+ return false;
}
/**
--
Gitblit v1.10.0