You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/10/15 13:50:59 UTC

svn commit: r584752 - /maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java

Author: vsiveton
Date: Mon Oct 15 04:50:56 2007
New Revision: 584752

URL: http://svn.apache.org/viewvc?rev=584752&view=rev
Log:
o added more parameters checks
o added task name and description

Modified:
    maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java

Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java?rev=584752&r1=584751&r2=584752&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-ant/src/main/java/org/apache/maven/jxr/ant/doc/Vizant.java Mon Oct 15 04:50:56 2007
@@ -56,6 +56,11 @@
     public void setAntfile( File antfile )
         throws BuildException
     {
+        if ( antfile == null )
+        {
+            throw new BuildException( "antfile could not be null", getLocation() );
+        }
+
         this.antfile = antfile;
         try
         {
@@ -63,7 +68,7 @@
         }
         catch ( FileNotFoundException e )
         {
-            throw new BuildException( e );
+            throw new BuildException( e, getLocation() );
         }
     }
 
@@ -124,6 +129,19 @@
         subgraph.setPrinter( printer );
     }
 
+    /** {@inheritDoc} */
+    public String getTaskName()
+    {
+        return "vizant";
+    }
+
+    /** {@inheritDoc} */
+    public String getDescription()
+    {
+        return "Generate Graphviz DOT source code from an Ant buildfile.";
+    }
+
+    /** {@inheritDoc} */
     public void execute()
         throws BuildException
     {
@@ -147,11 +165,15 @@
     {
         if ( antfile == null )
         {
-            throw new BuildException( "antfile attribute is required" );
+            throw new BuildException( "antfile attribute is required", getLocation() );
+        }
+        if ( !antfile.exists() )
+        {
+            throw new BuildException( "antfile attribute should exist.", getLocation() );
         }
         if ( outfile == null )
         {
-            throw new BuildException( "outfile attribute is required" );
+            throw new BuildException( "outfile attribute is required", getLocation() );
         }
     }
 
@@ -169,6 +191,10 @@
         throws BuildException
     {
         VizFileWriter out = null;
+        if ( !outfile.getParentFile().exists() && !outfile.getParentFile().mkdirs())
+        {
+            throw new BuildException( "Cannot create outfile parent dir.", getLocation() );
+        }
         try
         {
             out = new VizFileWriter( outfile );