camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jans...@apache.org
Subject svn commit: r726747 - /activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
Date Mon, 15 Dec 2008 18:01:20 GMT
Author: janstey
Date: Mon Dec 15 10:01:19 2008
New Revision: 726747

URL: http://svn.apache.org/viewvc?rev=726747&view=rev
Log:
Add check to ensure dot actually works before running it.

Modified:
    activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java

Modified: activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java?rev=726747&r1=726746&r2=726747&view=diff
==============================================================================
--- activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
(original)
+++ activemq/camel/trunk/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
Mon Dec 15 10:01:19 2008
@@ -446,8 +446,13 @@
     protected String convertFile(File file, String format) throws CommandLineException {
         Log log = getLog();
         if (!useDot) {
-            log.info("DOT generation disabled");
+            log.info("DOT generation disabled.");
             return null;
+        } else {            
+            if (dotHelpExitCode() != 0) {
+                log.info("'dot -?' execution failed so DOT generation disabled.");
+                return null;
+            }
         }
         if (this.executable == null || this.executable.length() == 0) {
             log.warn("Parameter <executable/> was not set in the pom.xml.  Skipping
conversion.");
@@ -480,6 +485,17 @@
         return generatedFileName;
     }
 
+    private int dotHelpExitCode() throws CommandLineException {
+        Commandline cl = new Commandline();
+        cl.setExecutable(executable);
+        cl.createArgument().setValue("-?");
+
+        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
+        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
+
+        return CommandLineUtils.executeCommandLine(cl, stdout, stderr);
+    }
+
     protected String removeFileExtension(String name) {
         int idx = name.lastIndexOf(".");
         if (idx > 0) {



Mime
View raw message