From 2e08d2c0e9bede644be993ddaa28157c9f156c10 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Tue, 07 May 2013 13:50:59 +0000
Subject: [PATCH] svn merge https://svn.forgerock.org/opendj/trunk/opends@8851 https://svn.forgerock.org/opendj/branches/native-packaging@8851 .

---
 opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
index 302502d..cdc916c 100644
--- a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
@@ -23,7 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions copyright 2011 ForgeRock AS
+ *      Portions copyright 2011-2013 ForgeRock AS
  */
 package org.opends.server.util.args;
 import org.opends.messages.Message;
@@ -741,11 +741,17 @@
     int numArguments = rawArguments.length;
     for (int i=0; i < numArguments; i++)
     {
-      String arg = rawArguments[i];
+      final String arg = rawArguments[i];
 
       if (inTrailingArgs)
       {
         trailingArguments.add(arg);
+
+        if (subCommand == null)
+        {
+          throw new ArgumentException(ERR_ARG_SUBCOMMAND_INVALID.get());
+        }
+
         if ((subCommand.getMaxTrailingArguments() > 0) &&
             (trailingArguments.size() > subCommand.getMaxTrailingArguments()))
         {

--
Gitblit v1.10.0