From 60b1359b65d8505c32f0598bf325043b7cedf843 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Tue, 16 Dec 2014 17:05:29 +0000
Subject: [PATCH] OPENDJ-1655 (CR-5676) Fix display of error message in dsconfig
---
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java
index 7e5fe48..0eccbcf 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyValueEditor.java
@@ -26,6 +26,7 @@
*/
package org.forgerock.opendj.config.dsconfig;
+import static com.forgerock.opendj.cli.ReturnCode.*;
import static com.forgerock.opendj.dsconfig.DsconfigMessages.*;
import java.util.ArrayList;
@@ -80,6 +81,8 @@
import com.forgerock.opendj.cli.TableBuilder;
import com.forgerock.opendj.cli.TextTablePrinter;
+import static org.forgerock.opendj.config.dsconfig.DSConfig.*;
+
/**
* Common methods used for interactively editing properties.
*/
@@ -131,13 +134,7 @@
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(pufn);
- if (app.isInteractive()) {
- app.println();
- app.printVerboseMessage(msg);
- return MenuResult.cancel();
- } else {
- throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
- }
+ return interactivePrintOrThrowError(app, msg, NO_SUCH_OBJECT);
}
// Now let the user create the child component.
@@ -148,9 +145,9 @@
// FIXME: should really do something better with the exception
// handling here. For example, if a authz or communications
// exception occurs then the application should exit.
- app.println();
- app.println(e.getMessageObject());
- app.println();
+ app.errPrintln();
+ app.errPrintln(e.getMessageObject());
+ app.errPrintln();
app.pressReturnToContinue();
return MenuResult.cancel();
}
@@ -1710,10 +1707,10 @@
app.println();
app.println(INFO_EDITOR_HEADING_CONFIGURE_PROPERTY.get(pd.getName()));
app.println();
- app.errPrintln(pd.getSynopsis(), 4);
+ app.println(pd.getSynopsis(), 4);
if (pd.getDescription() != null) {
app.println();
- app.errPrintln(pd.getDescription(), 4);
+ app.println(pd.getDescription(), 4);
}
}
@@ -1850,8 +1847,8 @@
break;
} catch (PropertyException e) {
- app.println();
- app.println(ArgumentExceptionFactory.adaptPropertyException(e, d).getMessageObject());
+ app.errPrintln();
+ app.errPrintln(ArgumentExceptionFactory.adaptPropertyException(e, d).getMessageObject());
}
}
}
@@ -1877,9 +1874,9 @@
values.add(value);
}
} catch (PropertyException e) {
- app.println();
- app.println(ArgumentExceptionFactory.adaptPropertyException(e, d).getMessageObject());
- app.println();
+ app.errPrintln();
+ app.errPrintln(ArgumentExceptionFactory.adaptPropertyException(e, d).getMessageObject());
+ app.errPrintln();
}
}
}
--
Gitblit v1.10.0