You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2013/09/25 21:12:12 UTC
svn commit: r1526269 -
/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
Author: burn
Date: Wed Sep 25 19:12:12 2013
New Revision: 1526269
URL: http://svn.apache.org/r1526269
Log:
UIMA-3290 Reject duplicate options with different values
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java?rev=1526269&r1=1526268&r2=1526269&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java Wed Sep 25 19:12:12 2013
@@ -345,6 +345,10 @@ public abstract class CliBase
if (val.contains("${")) {
val = resolvePlaceholders(val);
}
+ String oval = (String) cli_props.get(opt.getLongOpt());
+ if (oval != null && !oval.equals(val)) {
+ throw new Exception("Duplicate option specified: " + opt.getLongOpt());
+ }
}
cli_props.put(opt.getLongOpt(), val);
if (debug) System.out.println("CLI set " + opt.getLongOpt() + " = " + val);
@@ -813,8 +817,9 @@ public abstract class CliBase
}
/*
- * Change any deprecated options to their new name. If this produces duplicate specifications then the
- * commons-cli parser probably chooses the last one.
+ * Change any deprecated options to their new name. If this produces duplicate specifications with different
+ * values then a duplicate options error will be thrown.
+ * Could suppress this and use just one of them ????
*
*/
private void cleanupArgs(String[] args) {