You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2008/12/15 19:04:47 UTC

svn commit: r726748 - in /activemq/camel/branches/camel-1.x: ./ tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java

Author: janstey
Date: Mon Dec 15 10:04:46 2008
New Revision: 726748

URL: http://svn.apache.org/viewvc?rev=726748&view=rev
Log:
Merged revisions 726747 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r726747 | janstey | 2008-12-15 14:31:19 -0330 (Mon, 15 Dec 2008) | 1 line
  
  Add check to ensure dot actually works before running it.
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: activemq/camel/branches/camel-1.x/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java?rev=726748&r1=726747&r2=726748&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java (original)
+++ activemq/camel/branches/camel-1.x/tooling/maven/camel-maven-plugin/src/main/java/org/apache/camel/maven/DotMojo.java Mon Dec 15 10:04:46 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) {