ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink ClassNameReader.java JlinkTask.java jlink.java
Date Sun, 16 Dec 2001 00:36:15 GMT
donaldp     01/12/15 16:36:15

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink
                        ClassNameReader.java JlinkTask.java jlink.java
  Log:
  BuildException -> TaskException
  
  Removed uneeded imports.
  
  Processed code through style formatter.
  
  Revision  Changes    Path
  1.2       +38 -38    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
  
  Index: ClassNameReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClassNameReader.java	2001/12/15 12:06:28	1.1
  +++ ClassNameReader.java	2001/12/16 00:36:15	1.2
  @@ -6,6 +6,7 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.jlink;
  +
   import java.io.DataInput;
   import java.io.DataInputStream;
   import java.io.IOException;
  @@ -37,8 +38,8 @@
           // read access flags and class index.
           int accessFlags = data.readUnsignedShort();
           int classIndex = data.readUnsignedShort();
  -        Integer stringIndex = ( Integer )values[classIndex];
  -        String className = ( String )values[stringIndex.intValue()];
  +        Integer stringIndex = (Integer)values[ classIndex ];
  +        String className = (String)values[ stringIndex.intValue() ];
           return className;
       }
   
  @@ -55,10 +56,9 @@
   class ConstantPool extends Object
   {
   
  -
       final static byte UTF8 = 1, UNUSED = 2, INTEGER = 3, FLOAT = 4, LONG = 5, DOUBLE =
6,
  -        CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10,
  -        INTERFACEMETHODREF = 11, NAMEANDTYPE = 12;
  +    CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10,
  +    INTERFACEMETHODREF = 11, NAMEANDTYPE = 12;
   
       byte[] types;
   
  @@ -70,44 +70,44 @@
           super();
   
           int count = data.readUnsignedShort();
  -        types = new byte[count];
  -        values = new Object[count];
  +        types = new byte[ count ];
  +        values = new Object[ count ];
           // read in all constant pool entries.
           for( int i = 1; i < count; i++ )
           {
               byte type = data.readByte();
  -            types[i] = type;
  -            switch ( type )
  +            types[ i ] = type;
  +            switch( type )
               {
  -            case UTF8:
  -                values[i] = data.readUTF();
  -                break;
  -            case UNUSED:
  -                break;
  -            case INTEGER:
  -                values[i] = new Integer( data.readInt() );
  -                break;
  -            case FLOAT:
  -                values[i] = new Float( data.readFloat() );
  -                break;
  -            case LONG:
  -                values[i] = new Long( data.readLong() );
  -                ++i;
  -                break;
  -            case DOUBLE:
  -                values[i] = new Double( data.readDouble() );
  -                ++i;
  -                break;
  -            case CLASS:
  -            case STRING:
  -                values[i] = new Integer( data.readUnsignedShort() );
  -                break;
  -            case FIELDREF:
  -            case METHODREF:
  -            case INTERFACEMETHODREF:
  -            case NAMEANDTYPE:
  -                values[i] = new Integer( data.readInt() );
  -                break;
  +                case UTF8:
  +                    values[ i ] = data.readUTF();
  +                    break;
  +                case UNUSED:
  +                    break;
  +                case INTEGER:
  +                    values[ i ] = new Integer( data.readInt() );
  +                    break;
  +                case FLOAT:
  +                    values[ i ] = new Float( data.readFloat() );
  +                    break;
  +                case LONG:
  +                    values[ i ] = new Long( data.readLong() );
  +                    ++i;
  +                    break;
  +                case DOUBLE:
  +                    values[ i ] = new Double( data.readDouble() );
  +                    ++i;
  +                    break;
  +                case CLASS:
  +                case STRING:
  +                    values[ i ] = new Integer( data.readUnsignedShort() );
  +                    break;
  +                case FIELDREF:
  +                case METHODREF:
  +                case INTERFACEMETHODREF:
  +                case NAMEANDTYPE:
  +                    values[ i ] = new Integer( data.readInt() );
  +                    break;
               }
           }
       }
  
  
  
  1.3       +7 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java
  
  Index: JlinkTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JlinkTask.java	2001/12/15 14:55:58	1.2
  +++ JlinkTask.java	2001/12/16 00:36:15	1.3
  @@ -6,8 +6,9 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.jlink;
  +
   import java.io.File;
  -import org.apache.tools.ant.BuildException;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.MatchingTask;
   import org.apache.tools.ant.types.Path;
  @@ -138,19 +139,19 @@
       /**
        * Does the adding and merging.
        *
  -     * @exception BuildException Description of Exception
  +     * @exception TaskException Description of Exception
        */
       public void execute()
  -        throws BuildException
  +        throws TaskException
       {
           //Be sure everything has been set.
           if( outfile == null )
           {
  -            throw new BuildException( "outfile attribute is required! Please set." );
  +            throw new TaskException( "outfile attribute is required! Please set." );
           }
           if( !haveAddFiles() && !haveMergeFiles() )
           {
  -            throw new BuildException( "addfiles or mergefiles required! Please set." );
  +            throw new TaskException( "addfiles or mergefiles required! Please set." );
           }
           log( "linking:     " + outfile.getPath() );
           log( "compression: " + compress, Project.MSG_VERBOSE );
  @@ -173,7 +174,7 @@
           }
           catch( Exception ex )
           {
  -            throw new BuildException( "Error", ex);
  +            throw new TaskException( "Error", ex );
           }
       }
   
  
  
  
  1.2       +16 -12    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
  
  Index: jlink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jlink.java	2001/12/15 12:06:28	1.1
  +++ jlink.java	2001/12/16 00:36:15	1.2
  @@ -6,6 +6,7 @@
    * the LICENSE file.
    */
   package org.apache.tools.ant.taskdefs.optional.jlink;
  +
   import java.io.BufferedInputStream;
   import java.io.File;
   import java.io.FileInputStream;
  @@ -32,7 +33,7 @@
   
       private boolean compression = false;
   
  -    byte[] buffer = new byte[8192];
  +    byte[] buffer = new byte[ 8192 ];
   
       public static void main( String[] args )
       {
  @@ -43,11 +44,11 @@
               System.exit( 1 );
           }
           jlink linker = new jlink();
  -        linker.setOutfile( args[0] );
  +        linker.setOutfile( args[ 0 ] );
           //To maintain compatibility with the command-line version, we will only add files
to be merged.
           for( int i = 1; i < args.length; i++ )
           {
  -            linker.addMergeFile( args[i] );
  +            linker.addMergeFile( args[ i ] );
           }
           try
           {
  @@ -110,7 +111,7 @@
           }
           for( int i = 0; i < addfiles.length; i++ )
           {
  -            addAddFile( addfiles[i] );
  +            addAddFile( addfiles[ i ] );
           }
       }
   
  @@ -141,7 +142,7 @@
           }
           for( int i = 0; i < mergefiles.length; i++ )
           {
  -            addMergeFile( mergefiles[i] );
  +            addMergeFile( mergefiles[ i ] );
           }
       }
   
  @@ -174,7 +175,7 @@
           Enumeration merges = mergefiles.elements();
           while( merges.hasMoreElements() )
           {
  -            String path = ( String )merges.nextElement();
  +            String path = (String)merges.nextElement();
               File f = new File( path );
               if( f.getName().endsWith( ".jar" ) || f.getName().endsWith( ".zip" ) )
               {
  @@ -191,7 +192,7 @@
           Enumeration adds = addfiles.elements();
           while( adds.hasMoreElements() )
           {
  -            String name = ( String )adds.nextElement();
  +            String name = (String)adds.nextElement();
               File f = new File( name );
               if( f.isDirectory() )
               {
  @@ -210,7 +211,8 @@
                   output.close();
               }
               catch( IOException ioe )
  -            {}
  +            {
  +            }
           }
       }
   
  @@ -236,7 +238,8 @@
                   }
               }
               catch( IOException ioe )
  -            {}
  +            {
  +            }
           }
           System.out.println( "From " + file.getPath() + " and prefix " + prefix + ", creating
entry " + prefix + name );
           return ( prefix + name );
  @@ -251,7 +254,7 @@
           String[] contents = dir.list();
           for( int i = 0; i < contents.length; ++i )
           {
  -            String name = contents[i];
  +            String name = contents[ i ];
               File file = new File( dir, name );
               if( file.isDirectory() )
               {
  @@ -359,7 +362,7 @@
           Enumeration entries = zipf.entries();
           while( entries.hasMoreElements() )
           {
  -            ZipEntry inputEntry = ( ZipEntry )entries.nextElement();
  +            ZipEntry inputEntry = (ZipEntry)entries.nextElement();
               //Ignore manifest entries.  They're bound to cause conflicts between
               //files that are being merged.  User should supply their own
               //manifest file when doing the merge.
  @@ -439,7 +442,8 @@
                   }
               }
               catch( IOException ioe )
  -            {}
  +            {
  +            }
           }
           ZipEntry outputEntry = new ZipEntry( name );
           outputEntry.setTime( inputEntry.getTime() );
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message