You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@any23.apache.org by mo...@apache.org on 2012/05/21 15:22:00 UTC

svn commit: r1341008 - in /incubator/any23/trunk/core/src: main/java/org/apache/any23/cli/ToolRunner.java test/java/org/apache/any23/cli/RoverTest.java test/resources/cli/rover-test1.nq

Author: mostarda
Date: Mon May 21 13:21:59 2012
New Revision: 1341008

URL: http://svn.apache.org/viewvc?rev=1341008&view=rev
Log:
Removed System.exit() from ToolRunner code, found and resolved option conflict (-p 'plugins-dir' in ToolRunner conficted with -p 'pedantic' in Rover), removed header preventing correct MIMEType detection for Rover test. This commit is related to issue #ANY23-97.

Modified:
    incubator/any23/trunk/core/src/main/java/org/apache/any23/cli/ToolRunner.java
    incubator/any23/trunk/core/src/test/java/org/apache/any23/cli/RoverTest.java
    incubator/any23/trunk/core/src/test/resources/cli/rover-test1.nq

Modified: incubator/any23/trunk/core/src/main/java/org/apache/any23/cli/ToolRunner.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/core/src/main/java/org/apache/any23/cli/ToolRunner.java?rev=1341008&r1=1341007&r2=1341008&view=diff
==============================================================================
--- incubator/any23/trunk/core/src/main/java/org/apache/any23/cli/ToolRunner.java (original)
+++ incubator/any23/trunk/core/src/main/java/org/apache/any23/cli/ToolRunner.java Mon May 21 13:21:59 2012
@@ -58,7 +58,11 @@ public final class ToolRunner {
     @Parameter( names = { "-X", "--verbose" }, description = "Produce execution verbose output." )
     private boolean verbose;
 
-    @Parameter( names = { "-p", "--plugins-dir" }, description = "The Any23 plugins directory.", converter = FileConverter.class )
+    @Parameter(
+            names = { "--plugins-dir" },
+            description = "The Any23 plugins directory.",
+            converter = FileConverter.class
+    )
     private File pluginsDir = DEFAULT_PLUGIN_DIR;
 
     public static void main( String[] args ) throws Exception {
@@ -71,7 +75,13 @@ public final class ToolRunner {
 
         // TODO (low) : this dirty solution has been introduced because it is not possible to
         //              parse arguments ( commander.parse() ) twice.
-        final File pluginsDirOption = parsePluginDirOption(args);
+        final File pluginsDirOption;
+        try {
+            pluginsDirOption = parsePluginDirOption(args);
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+            return 1;
+        }
         if(pluginsDirOption != null) {
             pluginsDir = pluginsDirOption;
         }
@@ -234,20 +244,18 @@ public final class ToolRunner {
     private static File parsePluginDirOption(String[] args) {
         int optionIndex = -1;
         for(int i = 0; i < args.length; i++) {
-            if("-p".equals(args[i]) || "--plugins-dir".equals(args[i])) {
+            if("--plugins-dir".equals(args[i])) {
                 optionIndex = i;
             }
         }
         if(optionIndex == -1) return null;
 
         if(optionIndex == args.length - 1) {
-            System.err.println("Missing argument for --plugins-dir option.");
-            System.exit(1);
+            throw new IllegalArgumentException("Missing argument for --plugins-dir option.");
         }
         final File pluginsDir = new File( args[optionIndex + 1] );
         if( ! pluginsDir.isDirectory() ) {
-            System.err.println("Expected a directory for --plugins-dir option value.");
-            System.exit(1);
+            throw  new IllegalArgumentException("Expected a directory for --plugins-dir option value.");
         }
         return pluginsDir;
     }

Modified: incubator/any23/trunk/core/src/test/java/org/apache/any23/cli/RoverTest.java
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/core/src/test/java/org/apache/any23/cli/RoverTest.java?rev=1341008&r1=1341007&r2=1341008&view=diff
==============================================================================
--- incubator/any23/trunk/core/src/test/java/org/apache/any23/cli/RoverTest.java (original)
+++ incubator/any23/trunk/core/src/test/java/org/apache/any23/cli/RoverTest.java Mon May 21 13:21:59 2012
@@ -24,7 +24,6 @@ import org.apache.any23.util.StringUtils
 import org.apache.any23.util.URLUtils;
 import org.junit.Assert;
 import org.junit.Assume;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.openrdf.model.Statement;
 
@@ -35,7 +34,6 @@ import java.io.File;
  *
  * @author Michele Mostarda (mostarda@fbk.eu)
  */
-@Ignore
 public class RoverTest extends ToolTestBase {
 
     private static final String[] TARGET_FILES = {

Modified: incubator/any23/trunk/core/src/test/resources/cli/rover-test1.nq
URL: http://svn.apache.org/viewvc/incubator/any23/trunk/core/src/test/resources/cli/rover-test1.nq?rev=1341008&r1=1341007&r2=1341008&view=diff
==============================================================================
--- incubator/any23/trunk/core/src/test/resources/cli/rover-test1.nq (original)
+++ incubator/any23/trunk/core/src/test/resources/cli/rover-test1.nq Mon May 21 13:21:59 2012
@@ -1,20 +1,3 @@
-#
-#  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.
-#
-
 <http://vocab.sindice.net/csv/numberOfColumns> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://vocab.sindice.net/csv/> .
 <http://vocab.sindice.net/csv/numberOfColumns> <http://www.w3.org/2000/01/rdf-schema#member> <http://vocab.sindice.net/csv/> <http://vocab.sindice.net/csv/> .
 <http://vocab.sindice.net/csv/columnPosition> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> <http://vocab.sindice.net/csv/> .