You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2001/12/16 01:36:32 UTC

cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc JJTree.java JavaCC.java

donaldp     01/12/15 16:36:32

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc
                        JJTree.java JavaCC.java
  Log:
  BuildException -> TaskException
  
  Removed uneeded imports.
  
  Processed code through style formatter.
  
  Revision  Changes    Path
  1.2       +14 -14    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  
  Index: JJTree.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JJTree.java	2001/12/15 12:06:28	1.1
  +++ JJTree.java	2001/12/16 00:36:32	1.2
  @@ -6,11 +6,12 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.javacc;
  +
   import java.io.File;
   import java.io.IOException;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import org.apache.tools.ant.BuildException;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.Execute;
  @@ -58,7 +59,6 @@
           cmdl.setClassname( "COM.sun.labs.jjtree.Main" );
       }
   
  -
       public void setBuildnodefiles( boolean buildNodeFiles )
       {
           optionalAttrs.put( BUILD_NODE_FILES, new Boolean( buildNodeFiles ) );
  @@ -130,21 +130,21 @@
       }
   
       public void execute()
  -        throws BuildException
  +        throws TaskException
       {
   
           // load command line with optional attributes
           Enumeration iter = optionalAttrs.keys();
           while( iter.hasMoreElements() )
           {
  -            String name = ( String )iter.nextElement();
  +            String name = (String)iter.nextElement();
               Object value = optionalAttrs.get( name );
               cmdl.createArgument().setValue( "-" + name + ":" + value.toString() );
           }
   
           if( target == null || !target.isFile() )
           {
  -            throw new BuildException( "Invalid target: " + target );
  +            throw new TaskException( "Invalid target: " + target );
           }
   
           // use the directory containing the target as the output directory
  @@ -154,7 +154,7 @@
           }
           if( !outputDirectory.isDirectory() )
           {
  -            throw new BuildException( "'outputdirectory' " + outputDirectory + " is not a directory." );
  +            throw new TaskException( "'outputdirectory' " + outputDirectory + " is not a directory." );
           }
           // convert backslashes to slashes, otherwise jjtree will put this as
           // comments and this seems to confuse javacc
  @@ -163,7 +163,7 @@
   
           String targetName = target.getName();
           final File javaFile = new File( outputDirectory,
  -            targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" );
  +                                        targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" );
           if( javaFile.exists() && target.lastModified() < javaFile.lastModified() )
           {
               project.log( "Target is already built - skipping (" + target + ")" );
  @@ -173,11 +173,11 @@
   
           if( javaccHome == null || !javaccHome.isDirectory() )
           {
  -            throw new BuildException( "Javacchome not set." );
  +            throw new TaskException( "Javacchome not set." );
           }
           final Path classpath = cmdl.createClasspath( project );
           classpath.createPathElement().setPath( javaccHome.getAbsolutePath() +
  -            "/JavaCC.zip" );
  +                                               "/JavaCC.zip" );
           classpath.addJavaRuntime();
   
           final Commandline.Argument arg = cmdl.createVmArgument();
  @@ -186,9 +186,9 @@
   
           final Execute process =
               new Execute( new LogStreamHandler( this,
  -            Project.MSG_INFO,
  -            Project.MSG_INFO ),
  -            null );
  +                                               Project.MSG_INFO,
  +                                               Project.MSG_INFO ),
  +                         null );
           log( cmdl.toString(), Project.MSG_VERBOSE );
           process.setCommandline( cmdl.getCommandline() );
   
  @@ -196,12 +196,12 @@
           {
               if( process.execute() != 0 )
               {
  -                throw new BuildException( "JJTree failed." );
  +                throw new TaskException( "JJTree failed." );
               }
           }
           catch( IOException e )
           {
  -            throw new BuildException( "Failed to launch JJTree: " + e );
  +            throw new TaskException( "Failed to launch JJTree: " + e );
           }
       }
   }
  
  
  
  1.2       +8 -8      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java
  
  Index: JavaCC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaCC.java	2001/12/15 12:06:28	1.1
  +++ JavaCC.java	2001/12/16 00:36:32	1.2
  @@ -6,10 +6,11 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.javacc;
  +
   import java.io.File;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import org.apache.tools.ant.BuildException;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.taskdefs.Execute;
  @@ -130,7 +131,6 @@
           optionalAttrs.put( JAVA_UNICODE_ESCAPE, new Boolean( javaUnicodeEscape ) );
       }
   
  -
       public void setLookahead( int lookahead )
       {
           optionalAttrs.put( LOOKAHEAD, new Integer( lookahead ) );
  @@ -182,14 +182,14 @@
       }
   
       public void execute()
  -        throws BuildException
  +        throws TaskException
       {
   
           // load command line with optional attributes
           Enumeration iter = optionalAttrs.keys();
           while( iter.hasMoreElements() )
           {
  -            String name = ( String )iter.nextElement();
  +            String name = (String)iter.nextElement();
               Object value = optionalAttrs.get( name );
               cmdl.createArgument().setValue( "-" + name + ":" + value.toString() );
           }
  @@ -197,7 +197,7 @@
           // check the target is a file
           if( target == null || !target.isFile() )
           {
  -            throw new BuildException( "Invalid target: " + target );
  +            throw new TaskException( "Invalid target: " + target );
           }
   
           // use the directory containing the target as the output directory
  @@ -207,7 +207,7 @@
           }
           else if( !outputDirectory.isDirectory() )
           {
  -            throw new BuildException( "Outputdir not a directory." );
  +            throw new TaskException( "Outputdir not a directory." );
           }
           cmdl.createArgument().setValue(
               "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() );
  @@ -223,11 +223,11 @@
   
           if( javaccHome == null || !javaccHome.isDirectory() )
           {
  -            throw new BuildException( "Javacchome not set." );
  +            throw new TaskException( "Javacchome not set." );
           }
           final Path classpath = cmdl.createClasspath( project );
           classpath.createPathElement().setPath( javaccHome.getAbsolutePath() +
  -            "/JavaCC.zip" );
  +                                               "/JavaCC.zip" );
           classpath.addJavaRuntime();
   
           final Commandline.Argument arg = cmdl.createVmArgument();
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>