mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jcambon
05.09.2009 ce99899b787aaacd25aeb04dd4b8efee3a037b0c
Fix for issue #3852 : dsconfig : in interactive mode, should not exit if parent component does not exist

5 files modified
48 ■■■■ changed files
opends/src/messages/messages/dsconfig.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java 10 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java 20 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/dsconfig.properties
@@ -262,6 +262,8 @@
INFO_DSCFG_FINDER_PROMPT_SINGLE_1232=>>>> There is only one %s: "%s". Are you sure \
 that this is the correct one?
INFO_DSCFG_FINDER_PROMPT_MANY_1233=>>>> Select the %s from the following list:
SEVERE_ERR_DSCFG_ERROR_FINDER_NO_CHILDREN_NULL_1234=Unable to continue since there \
 is no such an object currently configured on the server
INFO_DSCFG_GENERAL_CHOICE_PROMPT_NOHELP_1237=Enter choice [1 - %d]:
INFO_DSCFG_GENERAL_CHOICE_PROMPT_HELP_1238=Enter choice [1 - %d,  ? - help]:
SEVERE_ERR_DSCFG_ERROR_GENERAL_CHOICE_1239=Invalid response. Please enter a \
opends/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
@@ -261,7 +261,13 @@
      if (!forceArgument.isPresent()) {
        Message pufn = path.getManagedObjectDefinition().getUserFriendlyName();
        Message msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(pufn);
        throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
        if (app.isInteractive()) {
          app.println();
          app.printVerboseMessage(msg);
          return MenuResult.cancel();
        } else {
          throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
        }
      } else {
        return MenuResult.success(0);
      }
opends/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
@@ -272,7 +272,13 @@
    } catch (ManagedObjectNotFoundException e) {
      ufn = path.getManagedObjectDefinition().getUserFriendlyName();
      Message msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(ufn);
      throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
      if (app.isInteractive()) {
        app.println();
        app.printVerboseMessage(msg);
        return MenuResult.cancel();
      } else {
        throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
      }
    }
    if (result.isQuit()) {
opends/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.server.tools.dsconfig;
@@ -151,7 +151,13 @@
          Message pufn = path.getManagedObjectDefinition()
              .getUserFriendlyName();
          Message msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(pufn);
          throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
          if (app.isInteractive()) {
            app.println();
            app.printVerboseMessage(msg);
            return MenuResult.cancel();
          } else {
            throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
          }
        }
        // Now let the user create the child component.
opends/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -722,8 +722,24 @@
      Message msg = ERR_DSCFG_ERROR_MODIFY_CME.get(ufn);
      throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
    } catch (ManagedObjectNotFoundException e) {
      throw ArgumentExceptionFactory.unknownValueForChildComponent(
        "\"" + names.get(names.size()-1) + "\"");
      String objName = names.get(names.size() - 1);
      ArgumentException except = null;
      Message msg;
      // if object name is 'null', get a user-friendly string to represent this
      if (objName == null) {
        msg = ERR_DSCFG_ERROR_FINDER_NO_CHILDREN_NULL.get();
        except = new ArgumentException(msg);
      } else {
       except = ArgumentExceptionFactory.unknownValueForChildComponent(
        "\"" + objName + "\"");
      }
      if (app.isInteractive()) {
        app.println();
        app.printVerboseMessage(except.getMessageObject());
        return MenuResult.cancel();
      } else {
        throw except;
      }
    }
    if (result.isQuit()) {