You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2010/12/22 18:58:03 UTC

svn commit: r1052012 - in /oodt/trunk: CHANGES.txt commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java

Author: bfoster
Date: Wed Dec 22 17:58:03 2010
New Revision: 1052012

URL: http://svn.apache.org/viewvc?rev=1052012&view=rev
Log:

- modified cas-common's cmd-line parser to throw a special OptionHelpException if no args are specified so it can be specifically trapped

------------------------

OODT-103

Added:
    oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java   (with props)
Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1052012&r1=1052011&r2=1052012&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Wed Dec 22 17:58:03 2010
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.2 (Current Development)
 --------------------------------------------
 
+* OODT-103 modify cas-common's cmd-line parser to throw a special OptionHelpException if no args 
+  are specified so it can be specifically trapped (bfoster)
+
 * OODT-192 cas-catalog should require a metadata flag for allowing Transaction updates (bfoster)
 
 * OODT-95 cas-catalog throws exceptions with blank messages (bfoster)

Added: oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java
URL: http://svn.apache.org/viewvc/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java?rev=1052012&view=auto
==============================================================================
--- oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java (added)
+++ oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java Wed Dec 22 17:58:03 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.commons.option;
+
+//JDK imports
+import java.io.IOException;
+
+/**
+ * 
+ * @author bfoster
+ * Exception thrown to express that -h should be given to see help
+ *
+ */
+public class OptionHelpException extends IOException {
+
+	private static final long serialVersionUID = -8198106641155733222L;
+
+	public OptionHelpException() {
+		super();
+	}
+	
+	public OptionHelpException(String message) {
+		super(message);
+	}
+	
+}

Propchange: oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/OptionHelpException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java
URL: http://svn.apache.org/viewvc/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java?rev=1052012&r1=1052011&r2=1052012&view=diff
==============================================================================
--- oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java (original)
+++ oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java Wed Dec 22 17:58:03 2010
@@ -27,6 +27,7 @@ import java.util.List;
 //OODT imports
 import org.apache.oodt.commons.option.CmdLineOption;
 import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.OptionHelpException;
 import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
 import org.apache.oodt.commons.option.util.CmdLineOptionsUsagePrinter;
 
@@ -52,7 +53,7 @@ public class CmdLineOptionParser {
     public List<CmdLineOptionInstance> parse(String[] args) throws IOException {
         List<CmdLineOptionInstance> optionInstances = new LinkedList<CmdLineOptionInstance>();
         if (args.length < 1)
-            throw new IOException(
+            throw new OptionHelpException(
                     "Must specify options : type -h or --help for info");
 
         for (int j = 0; j < args.length; j++) {