From 01bf9b6a5d324d45355659581e9ebbd1280834fe Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 25 Apr 2016 14:41:26 +0000
Subject: [PATCH] Improvements suggested by UCDetector: remove dead code, add final keywords, change visibilities
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java | 38 ++++++++++++++++----------------------
1 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
index 4f32520..11d737d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
@@ -69,8 +69,8 @@
*/
public abstract class Task
{
- private static String localHostName = UserData.getDefaultHostName();
- private String binDir;
+ private static final String localHostName = UserData.getDefaultHostName();
+ private static final int MAX_BINARY_LENGTH_TO_DISPLAY = 1024;
/** The different task types. */
public enum Type
@@ -161,17 +161,15 @@
* a bug, because of the way the contents of logs is updated, using
* StringBuffer instead of StringBuilder is required.
*/
- private StringBuffer logs = new StringBuffer();
+ private final StringBuffer logs = new StringBuffer();
/** The error logs of the task. */
- private StringBuilder errorLogs = new StringBuilder();
+ private final StringBuilder errorLogs = new StringBuilder();
/** The standard output logs of the task. */
- private StringBuilder outputLogs = new StringBuilder();
+ private final StringBuilder outputLogs = new StringBuilder();
/** The print stream for the error logs. */
- protected ApplicationPrintStream errorPrintStream =
- new ApplicationPrintStream();
+ protected final ApplicationPrintStream errorPrintStream = new ApplicationPrintStream();
/** The print stream for the standard output logs. */
- protected ApplicationPrintStream outPrintStream =
- new ApplicationPrintStream();
+ protected final ApplicationPrintStream outPrintStream = new ApplicationPrintStream();
/**
* The process (if any) that the task launched. For instance if this is a
@@ -179,15 +177,11 @@
* command-line.
*/
private Process process;
- private ControlPanelInfo info;
-
- private ServerDescriptor server;
-
- private ProgressDialog progressDialog;
-
- private ArrayList<ConfigurationElementCreatedListener> confListeners = new ArrayList<>();
-
- private static int MAX_BINARY_LENGTH_TO_DISPLAY = 1024;
+ private final ControlPanelInfo info;
+ private final ServerDescriptor server;
+ private String binDir;
+ private final ProgressDialog progressDialog;
+ private final List<ConfigurationElementCreatedListener> confListeners = new ArrayList<>();
/**
* Constructor of the task.
@@ -419,7 +413,7 @@
* @return the obfuscated String representing the attribute value to be
* displayed in the logs of the user.
*/
- protected String obfuscateAttributeStringValue(String attrName, Object o)
+ private String obfuscateAttributeStringValue(String attrName, Object o)
{
if (Utilities.mustObfuscate(attrName,
getInfo().getServerDescriptor().getSchema()))
@@ -557,7 +551,7 @@
* Returns the binary/script directory.
* @return the binary/script directory.
*/
- protected String getBinaryDir()
+ private String getBinaryDir()
{
if (binDir == null)
{
@@ -826,7 +820,7 @@
* @param mods the modifications.
* @param useAdminCtx use the administration connector.
*/
- protected void printEquivalentCommandToModify(String dn,
+ private void printEquivalentCommandToModify(String dn,
Collection<ModificationItem> mods, boolean useAdminCtx)
{
ArrayList<String> args = new ArrayList<>(getObfuscatedCommandLineArguments(
@@ -946,7 +940,7 @@
* @return <CODE>true</CODE> if the attribute must be displayed using base 64
* and <CODE>false</CODE> otherwise.
*/
- protected boolean displayBase64(String attrName)
+ private boolean displayBase64(String attrName)
{
Schema schema = null;
if (getInfo() != null)
--
Gitblit v1.10.0