- Fix duplicate/unecessary imports - Fix single if/else and loop without block git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270813 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -22,7 +22,7 @@ import org.apache.aut.bzip2.CBZip2OutputStream; | |||||
| public class BZip2 | public class BZip2 | ||||
| extends Pack | extends Pack | ||||
| { | { | ||||
| private static final byte[] HEADER = new byte[]{(byte)'B', (byte)'Z'}; | |||||
| private final static byte[] HEADER = new byte[]{(byte)'B', (byte)'Z'}; | |||||
| protected OutputStream getPackingStream( OutputStream output ) | protected OutputStream getPackingStream( OutputStream output ) | ||||
| throws TaskException, IOException | throws TaskException, IOException | ||||
| @@ -12,7 +12,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.util.zip.GZIPOutputStream; | |||||
| import org.apache.avalon.excalibur.io.IOUtil; | import org.apache.avalon.excalibur.io.IOUtil; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| @@ -26,7 +26,7 @@ import org.apache.myrmidon.framework.AbstractContainerTask; | |||||
| public class LoadProperties | public class LoadProperties | ||||
| extends AbstractContainerTask | extends AbstractContainerTask | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( LoadProperties.class ); | ResourceManager.getPackageResources( LoadProperties.class ); | ||||
| private String m_prefix; | private String m_prefix; | ||||
| @@ -34,7 +34,7 @@ public class Property | |||||
| extends AbstractContainerTask | extends AbstractContainerTask | ||||
| implements Configurable | implements Configurable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Property.class ); | ResourceManager.getPackageResources( Property.class ); | ||||
| private String m_name; | private String m_name; | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToBooleanConverter | public class StringToBooleanConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToBooleanConverter.class ); | ResourceManager.getPackageResources( StringToBooleanConverter.class ); | ||||
| public StringToBooleanConverter() | public StringToBooleanConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToByteConverter | public class StringToByteConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToByteConverter.class ); | ResourceManager.getPackageResources( StringToByteConverter.class ); | ||||
| public StringToByteConverter() | public StringToByteConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToClassConverter | public class StringToClassConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToClassConverter.class ); | ResourceManager.getPackageResources( StringToClassConverter.class ); | ||||
| public StringToClassConverter() | public StringToClassConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToDoubleConverter | public class StringToDoubleConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToDoubleConverter.class ); | ResourceManager.getPackageResources( StringToDoubleConverter.class ); | ||||
| public StringToDoubleConverter() | public StringToDoubleConverter() | ||||
| @@ -25,7 +25,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToEnumConverter | public class StringToEnumConverter | ||||
| implements Converter | implements Converter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToEnumConverter.class ); | ResourceManager.getPackageResources( StringToEnumConverter.class ); | ||||
| public Object convert( final Class destination, | public Object convert( final Class destination, | ||||
| @@ -25,7 +25,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToFileConverter | public class StringToFileConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToFileConverter.class ); | ResourceManager.getPackageResources( StringToFileConverter.class ); | ||||
| public StringToFileConverter() | public StringToFileConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToFloatConverter | public class StringToFloatConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToFloatConverter.class ); | ResourceManager.getPackageResources( StringToFloatConverter.class ); | ||||
| public StringToFloatConverter() | public StringToFloatConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToIntegerConverter | public class StringToIntegerConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToFloatConverter.class ); | ResourceManager.getPackageResources( StringToFloatConverter.class ); | ||||
| public StringToIntegerConverter() | public StringToIntegerConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToLongConverter | public class StringToLongConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToLongConverter.class ); | ResourceManager.getPackageResources( StringToLongConverter.class ); | ||||
| public StringToLongConverter() | public StringToLongConverter() | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToShortConverter | public class StringToShortConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToShortConverter.class ); | ResourceManager.getPackageResources( StringToShortConverter.class ); | ||||
| public StringToShortConverter() | public StringToShortConverter() | ||||
| @@ -24,7 +24,7 @@ import org.apache.myrmidon.converter.ConverterException; | |||||
| public class StringToURLConverter | public class StringToURLConverter | ||||
| extends AbstractConverter | extends AbstractConverter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( StringToURLConverter.class ); | ResourceManager.getPackageResources( StringToURLConverter.class ); | ||||
| public StringToURLConverter() | public StringToURLConverter() | ||||
| @@ -44,7 +44,7 @@ public class CVSPass | |||||
| /** | /** | ||||
| * Array contain char conversion data | * Array contain char conversion data | ||||
| */ | */ | ||||
| private static final char[] c_shifts = | |||||
| private final static char[] c_shifts = | |||||
| { | { | ||||
| 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||||
| 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, | ||||
| @@ -148,7 +148,9 @@ public class Cvs | |||||
| final Execute2 exe = new Execute2(); | final Execute2 exe = new Execute2(); | ||||
| setupLogger( exe ); | setupLogger( exe ); | ||||
| if( m_dest == null ) m_dest = getBaseDirectory(); | |||||
| if( m_dest == null ) { | |||||
| m_dest = getBaseDirectory(); | |||||
| } | |||||
| exe.setWorkingDirectory( m_dest ); | exe.setWorkingDirectory( m_dest ); | ||||
| exe.setCommandline( command.getCommandline() ); | exe.setCommandline( command.getCommandline() ); | ||||
| @@ -34,7 +34,7 @@ import org.apache.tools.ant.types.EnvironmentVariable; | |||||
| public class Exec | public class Exec | ||||
| extends AbstractTask | extends AbstractTask | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Exec.class ); | ResourceManager.getPackageResources( Exec.class ); | ||||
| private long m_timeout; | private long m_timeout; | ||||
| @@ -27,7 +27,7 @@ import org.apache.aut.nativelib.ExecException; | |||||
| public class LoadEnvironment | public class LoadEnvironment | ||||
| extends AbstractTask | extends AbstractTask | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( LoadEnvironment.class ); | ResourceManager.getPackageResources( LoadEnvironment.class ); | ||||
| private String m_prefix; | private String m_prefix; | ||||
| @@ -30,7 +30,7 @@ public class ConverterDef | |||||
| extends AbstractTask | extends AbstractTask | ||||
| implements Composable | implements Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( ConverterDef.class ); | ResourceManager.getPackageResources( ConverterDef.class ); | ||||
| private String m_sourceType; | private String m_sourceType; | ||||
| @@ -32,7 +32,7 @@ public class Facility | |||||
| extends AbstractContainerTask | extends AbstractContainerTask | ||||
| implements Composable, Configurable | implements Composable, Configurable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Facility.class ); | ResourceManager.getPackageResources( Facility.class ); | ||||
| private String m_namespace; | private String m_namespace; | ||||
| @@ -27,7 +27,7 @@ public class Import | |||||
| extends AbstractTask | extends AbstractTask | ||||
| implements Composable | implements Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Import.class ); | ResourceManager.getPackageResources( Import.class ); | ||||
| private File m_lib; | private File m_lib; | ||||
| @@ -18,7 +18,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public class SubElementTest | public class SubElementTest | ||||
| extends AbstractTask | extends AbstractTask | ||||
| { | { | ||||
| public static final class Beep | |||||
| public final static class Beep | |||||
| { | { | ||||
| public void setMessage( final String string ) | public void setMessage( final String string ) | ||||
| { | { | ||||
| @@ -182,8 +182,9 @@ public class TraXLiaison | |||||
| if( e.getLocator().getSystemId() != null ) | if( e.getLocator().getSystemId() != null ) | ||||
| { | { | ||||
| String url = e.getLocator().getSystemId(); | String url = e.getLocator().getSystemId(); | ||||
| if( url.startsWith( "file:///" ) ) | |||||
| if( url.startsWith( "file:///" ) ) { | |||||
| url = url.substring( 8 ); | url = url.substring( 8 ); | ||||
| } | |||||
| msg.append( url ); | msg.append( url ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -8,12 +8,12 @@ | |||||
| package org.apache.antlib.xml; | package org.apache.antlib.xml; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.FileInputStream; | |||||
| import java.io.FileNotFoundException; | |||||
| import java.io.FileReader; | import java.io.FileReader; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | |||||
| import java.net.MalformedURLException; | |||||
| import java.net.URL; | import java.net.URL; | ||||
| import java.net.URLClassLoader; | import java.net.URLClassLoader; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| @@ -26,13 +26,13 @@ import org.apache.tools.ant.types.FileSet; | |||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
| import org.xml.sax.EntityResolver; | import org.xml.sax.EntityResolver; | ||||
| import org.xml.sax.ErrorHandler; | |||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| import org.xml.sax.Parser; | import org.xml.sax.Parser; | ||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| import org.xml.sax.SAXNotRecognizedException; | import org.xml.sax.SAXNotRecognizedException; | ||||
| import org.xml.sax.SAXNotSupportedException; | import org.xml.sax.SAXNotSupportedException; | ||||
| import org.xml.sax.SAXParseException; | |||||
| import org.xml.sax.XMLReader; | import org.xml.sax.XMLReader; | ||||
| import org.xml.sax.helpers.ParserAdapter; | import org.xml.sax.helpers.ParserAdapter; | ||||
| @@ -7,7 +7,7 @@ | |||||
| */ | */ | ||||
| package org.apache.antlib.xml; | package org.apache.antlib.xml; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| public final class XSLTParam | public final class XSLTParam | ||||
| { | { | ||||
| @@ -244,8 +244,9 @@ public class XSLTProcess | |||||
| for( int j = 0; j < dirs.length; ++j ) | for( int j = 0; j < dirs.length; ++j ) | ||||
| { | { | ||||
| list = new File( m_baseDir, dirs[ j ] ).list(); | list = new File( m_baseDir, dirs[ j ] ).list(); | ||||
| for( int i = 0; i < list.length; ++i ) | |||||
| for( int i = 0; i < list.length; ++i ) { | |||||
| process( m_baseDir, list[ i ], m_destDir, stylesheet ); | process( m_baseDir, list[ i ], m_destDir, stylesheet ); | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -470,8 +471,9 @@ public class XSLTProcess | |||||
| catch( Exception ex ) | catch( Exception ex ) | ||||
| { | { | ||||
| getLogger().info( "Failed to process " + inFile ); | getLogger().info( "Failed to process " + inFile ); | ||||
| if( outFile != null ) | |||||
| if( outFile != null ) { | |||||
| outFile.delete(); | outFile.delete(); | ||||
| } | |||||
| throw new TaskException( "Error", ex ); | throw new TaskException( "Error", ex ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -38,8 +38,9 @@ public class XalanLiaison | |||||
| public void setOutputtype( String type ) | public void setOutputtype( String type ) | ||||
| throws Exception | throws Exception | ||||
| { | { | ||||
| if( !type.equals( "xml" ) ) | |||||
| if( !type.equals( "xml" ) ) { | |||||
| throw new TaskException( "Unsupported output type: " + type ); | throw new TaskException( "Unsupported output type: " + type ); | ||||
| } | |||||
| } | } | ||||
| public void setStylesheet( File stylesheet ) | public void setStylesheet( File stylesheet ) | ||||
| @@ -175,8 +175,9 @@ public class CBZip2InputStream | |||||
| m_blockSize100k = newSize100k; | m_blockSize100k = newSize100k; | ||||
| if( newSize100k == 0 ) | |||||
| if( newSize100k == 0 ) { | |||||
| return; | return; | ||||
| } | |||||
| int n = BASE_BLOCK_SIZE * newSize100k; | int n = BASE_BLOCK_SIZE * newSize100k; | ||||
| m_ll8 = new char[ n ]; | m_ll8 = new char[ n ]; | ||||
| @@ -302,8 +303,9 @@ public class CBZip2InputStream | |||||
| { | { | ||||
| m_rNToGo = RAND_NUMS[ m_rTPos ]; | m_rNToGo = RAND_NUMS[ m_rTPos ]; | ||||
| m_rTPos++; | m_rTPos++; | ||||
| if( m_rTPos == 512 ) | |||||
| if( m_rTPos == 512 ) { | |||||
| m_rTPos = 0; | m_rTPos = 0; | ||||
| } | |||||
| } | } | ||||
| m_rNToGo--; | m_rNToGo--; | ||||
| ch2 ^= (int)( ( m_rNToGo == 1 ) ? 1 : 0 ); | ch2 ^= (int)( ( m_rNToGo == 1 ) ? 1 : 0 ); | ||||
| @@ -340,8 +342,9 @@ public class CBZip2InputStream | |||||
| { | { | ||||
| m_rNToGo = RAND_NUMS[ m_rTPos ]; | m_rNToGo = RAND_NUMS[ m_rTPos ]; | ||||
| m_rTPos++; | m_rTPos++; | ||||
| if( m_rTPos == 512 ) | |||||
| if( m_rTPos == 512 ) { | |||||
| m_rTPos = 0; | m_rTPos = 0; | ||||
| } | |||||
| } | } | ||||
| m_rNToGo--; | m_rNToGo--; | ||||
| z ^= ( ( m_rNToGo == 1 ) ? 1 : 0 ); | z ^= ( ( m_rNToGo == 1 ) ? 1 : 0 ); | ||||
| @@ -464,10 +467,11 @@ public class CBZip2InputStream | |||||
| int N = 1; | int N = 1; | ||||
| do | do | ||||
| { | { | ||||
| if( nextSym == RUNA ) | |||||
| if( nextSym == RUNA ) { | |||||
| s = s + ( 0 + 1 ) * N; | s = s + ( 0 + 1 ) * N; | ||||
| else if( nextSym == RUNB ) | |||||
| } else if( nextSym == RUNB ) { | |||||
| s = s + ( 1 + 1 ) * N; | s = s + ( 1 + 1 ) * N; | ||||
| } | |||||
| N = N * 2; | N = N * 2; | ||||
| if( groupPos == 0 ) | if( groupPos == 0 ) | ||||
| @@ -187,8 +187,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int weight[] = new int[ MAX_ALPHA_SIZE * 2 ]; | int weight[] = new int[ MAX_ALPHA_SIZE * 2 ]; | ||||
| int parent[] = new int[ MAX_ALPHA_SIZE * 2 ]; | int parent[] = new int[ MAX_ALPHA_SIZE * 2 ]; | ||||
| for( i = 0; i < alphaSize; i++ ) | |||||
| for( i = 0; i < alphaSize; i++ ) { | |||||
| weight[ i + 1 ] = ( freq[ i ] == 0 ? 1 : freq[ i ] ) << 8; | weight[ i + 1 ] = ( freq[ i ] == 0 ? 1 : freq[ i ] ) << 8; | ||||
| } | |||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| @@ -217,8 +218,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| heap[ zz ] = tmp; | heap[ zz ] = tmp; | ||||
| } | } | ||||
| } | } | ||||
| if( !( nHeap < ( MAX_ALPHA_SIZE + 2 ) ) ) | |||||
| if( !( nHeap < ( MAX_ALPHA_SIZE + 2 ) ) ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| while( nHeap > 1 ) | while( nHeap > 1 ) | ||||
| { | { | ||||
| @@ -234,13 +236,16 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| yy = zz << 1; | yy = zz << 1; | ||||
| if( yy > nHeap ) | |||||
| if( yy > nHeap ) { | |||||
| break; | break; | ||||
| } | |||||
| if( yy < nHeap && | if( yy < nHeap && | ||||
| weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) | |||||
| weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) { | |||||
| yy++; | yy++; | ||||
| if( weight[ tmp ] < weight[ heap[ yy ] ] ) | |||||
| } | |||||
| if( weight[ tmp ] < weight[ heap[ yy ] ] ) { | |||||
| break; | break; | ||||
| } | |||||
| heap[ zz ] = heap[ yy ]; | heap[ zz ] = heap[ yy ]; | ||||
| zz = yy; | zz = yy; | ||||
| } | } | ||||
| @@ -258,13 +263,16 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| yy = zz << 1; | yy = zz << 1; | ||||
| if( yy > nHeap ) | |||||
| if( yy > nHeap ) { | |||||
| break; | break; | ||||
| } | |||||
| if( yy < nHeap && | if( yy < nHeap && | ||||
| weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) | |||||
| weight[ heap[ yy + 1 ] ] < weight[ heap[ yy ] ] ) { | |||||
| yy++; | yy++; | ||||
| if( weight[ tmp ] < weight[ heap[ yy ] ] ) | |||||
| } | |||||
| if( weight[ tmp ] < weight[ heap[ yy ] ] ) { | |||||
| break; | break; | ||||
| } | |||||
| heap[ zz ] = heap[ yy ]; | heap[ zz ] = heap[ yy ]; | ||||
| zz = yy; | zz = yy; | ||||
| } | } | ||||
| @@ -296,8 +304,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| heap[ zz ] = tmp; | heap[ zz ] = tmp; | ||||
| } | } | ||||
| } | } | ||||
| if( !( nNodes < ( MAX_ALPHA_SIZE * 2 ) ) ) | |||||
| if( !( nNodes < ( MAX_ALPHA_SIZE * 2 ) ) ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| tooLong = false; | tooLong = false; | ||||
| for( i = 1; i <= alphaSize; i++ ) | for( i = 1; i <= alphaSize; i++ ) | ||||
| @@ -310,12 +319,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| j++; | j++; | ||||
| } | } | ||||
| len[ i - 1 ] = (char)j; | len[ i - 1 ] = (char)j; | ||||
| if( j > maxLen ) | |||||
| if( j > maxLen ) { | |||||
| tooLong = true; | tooLong = true; | ||||
| } | |||||
| } | } | ||||
| if( !tooLong ) | |||||
| if( !tooLong ) { | |||||
| break; | break; | ||||
| } | |||||
| for( i = 1; i < alphaSize; i++ ) | for( i = 1; i < alphaSize; i++ ) | ||||
| { | { | ||||
| @@ -335,11 +346,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| public void close() | public void close() | ||||
| throws IOException | throws IOException | ||||
| { | { | ||||
| if( closed ) | |||||
| if( closed ) { | |||||
| return; | return; | ||||
| } | |||||
| if( runLength > 0 ) | |||||
| if( runLength > 0 ) { | |||||
| writeRun(); | writeRun(); | ||||
| } | |||||
| currentChar = -1; | currentChar = -1; | ||||
| endBlock(); | endBlock(); | ||||
| endCompression(); | endCompression(); | ||||
| @@ -520,16 +533,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| } | } | ||||
| origPtr = -1; | origPtr = -1; | ||||
| for( i = 0; i <= last; i++ ) | |||||
| for( i = 0; i <= last; i++ ) { | |||||
| if( zptr[ i ] == 0 ) | if( zptr[ i ] == 0 ) | ||||
| { | { | ||||
| origPtr = i; | origPtr = i; | ||||
| break; | break; | ||||
| } | } | ||||
| } | |||||
| ; | ; | ||||
| if( origPtr == -1 ) | |||||
| if( origPtr == -1 ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| } | } | ||||
| private void endBlock() | private void endBlock() | ||||
| @@ -620,43 +635,49 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| @@ -666,45 +687,53 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| s1 = quadrant[ i1 ]; | s1 = quadrant[ i1 ]; | ||||
| s2 = quadrant[ i2 ]; | s2 = quadrant[ i2 ]; | ||||
| if( s1 != s2 ) | |||||
| if( s1 != s2 ) { | |||||
| return ( s1 > s2 ); | return ( s1 > s2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| s1 = quadrant[ i1 ]; | s1 = quadrant[ i1 ]; | ||||
| s2 = quadrant[ i2 ]; | s2 = quadrant[ i2 ]; | ||||
| if( s1 != s2 ) | |||||
| if( s1 != s2 ) { | |||||
| return ( s1 > s2 ); | return ( s1 > s2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| s1 = quadrant[ i1 ]; | s1 = quadrant[ i1 ]; | ||||
| s2 = quadrant[ i2 ]; | s2 = quadrant[ i2 ]; | ||||
| if( s1 != s2 ) | |||||
| if( s1 != s2 ) { | |||||
| return ( s1 > s2 ); | return ( s1 > s2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| c1 = block[ i1 + 1 ]; | c1 = block[ i1 + 1 ]; | ||||
| c2 = block[ i2 + 1 ]; | c2 = block[ i2 + 1 ]; | ||||
| if( c1 != c2 ) | |||||
| if( c1 != c2 ) { | |||||
| return ( c1 > c2 ); | return ( c1 > c2 ); | ||||
| } | |||||
| s1 = quadrant[ i1 ]; | s1 = quadrant[ i1 ]; | ||||
| s2 = quadrant[ i2 ]; | s2 = quadrant[ i2 ]; | ||||
| if( s1 != s2 ) | |||||
| if( s1 != s2 ) { | |||||
| return ( s1 > s2 ); | return ( s1 > s2 ); | ||||
| } | |||||
| i1++; | i1++; | ||||
| i2++; | i2++; | ||||
| @@ -742,13 +771,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| makeMaps(); | makeMaps(); | ||||
| EOB = nInUse + 1; | EOB = nInUse + 1; | ||||
| for( i = 0; i <= EOB; i++ ) | |||||
| for( i = 0; i <= EOB; i++ ) { | |||||
| mtfFreq[ i ] = 0; | mtfFreq[ i ] = 0; | ||||
| } | |||||
| wr = 0; | wr = 0; | ||||
| zPend = 0; | zPend = 0; | ||||
| for( i = 0; i < nInUse; i++ ) | |||||
| for( i = 0; i < nInUse; i++ ) { | |||||
| yy[ i ] = (char)i; | yy[ i ] = (char)i; | ||||
| } | |||||
| for( i = 0; i <= last; i++ ) | for( i = 0; i <= last; i++ ) | ||||
| { | { | ||||
| @@ -793,8 +824,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| break; | break; | ||||
| } | } | ||||
| ; | ; | ||||
| if( zPend < 2 ) | |||||
| if( zPend < 2 ) { | |||||
| break; | break; | ||||
| } | |||||
| zPend = ( zPend - 2 ) / 2; | zPend = ( zPend - 2 ) / 2; | ||||
| } | } | ||||
| ; | ; | ||||
| @@ -824,8 +856,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| mtfFreq[ RUNB ]++; | mtfFreq[ RUNB ]++; | ||||
| break; | break; | ||||
| } | } | ||||
| if( zPend < 2 ) | |||||
| if( zPend < 2 ) { | |||||
| break; | break; | ||||
| } | |||||
| zPend = ( zPend - 2 ) / 2; | zPend = ( zPend - 2 ) / 2; | ||||
| } | } | ||||
| } | } | ||||
| @@ -847,12 +880,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| vec = 0; | vec = 0; | ||||
| for( n = minLen; n <= maxLen; n++ ) | for( n = minLen; n <= maxLen; n++ ) | ||||
| { | { | ||||
| for( i = 0; i < alphaSize; i++ ) | |||||
| for( i = 0; i < alphaSize; i++ ) { | |||||
| if( length[ i ] == n ) | if( length[ i ] == n ) | ||||
| { | { | ||||
| code[ i ] = vec; | code[ i ] = vec; | ||||
| vec++; | vec++; | ||||
| } | } | ||||
| } | |||||
| ; | ; | ||||
| vec <<= 1; | vec <<= 1; | ||||
| } | } | ||||
| @@ -865,8 +899,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| last = -1; | last = -1; | ||||
| // ch = 0; | // ch = 0; | ||||
| for( int i = 0; i < 256; i++ ) | |||||
| for( int i = 0; i < 256; i++ ) { | |||||
| inUse[ i ] = false; | inUse[ i ] = false; | ||||
| } | |||||
| /* | /* | ||||
| * 20 is just a paranoia constant | * 20 is just a paranoia constant | ||||
| @@ -910,10 +945,12 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| * set up the overshoot area for block. | * set up the overshoot area for block. | ||||
| */ | */ | ||||
| // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" ); | // if (verbosity >= 4) fprintf ( stderr, " sort initialise ...\n" ); | ||||
| for( i = 0; i < NUM_OVERSHOOT_BYTES; i++ ) | |||||
| for( i = 0; i < NUM_OVERSHOOT_BYTES; i++ ) { | |||||
| block[ last + i + 2 ] = block[ ( i % ( last + 1 ) ) + 1 ]; | block[ last + i + 2 ] = block[ ( i % ( last + 1 ) ) + 1 ]; | ||||
| for( i = 0; i <= last + NUM_OVERSHOOT_BYTES; i++ ) | |||||
| } | |||||
| for( i = 0; i <= last + NUM_OVERSHOOT_BYTES; i++ ) { | |||||
| quadrant[ i ] = 0; | quadrant[ i ] = 0; | ||||
| } | |||||
| block[ 0 ] = (char)( block[ last + 1 ] ); | block[ 0 ] = (char)( block[ last + 1 ] ); | ||||
| @@ -923,8 +960,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| * Use simpleSort(), since the full sorting mechanism | * Use simpleSort(), since the full sorting mechanism | ||||
| * has quite a large constant overhead. | * has quite a large constant overhead. | ||||
| */ | */ | ||||
| for( i = 0; i <= last; i++ ) | |||||
| for( i = 0; i <= last; i++ ) { | |||||
| zptr[ i ] = i; | zptr[ i ] = i; | ||||
| } | |||||
| firstAttempt = false; | firstAttempt = false; | ||||
| workDone = workLimit = 0; | workDone = workLimit = 0; | ||||
| simpleSort( 0, last, 0 ); | simpleSort( 0, last, 0 ); | ||||
| @@ -932,11 +970,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| else | else | ||||
| { | { | ||||
| numQSorted = 0; | numQSorted = 0; | ||||
| for( i = 0; i <= 255; i++ ) | |||||
| for( i = 0; i <= 255; i++ ) { | |||||
| bigDone[ i ] = false; | bigDone[ i ] = false; | ||||
| } | |||||
| for( i = 0; i <= 65536; i++ ) | |||||
| for( i = 0; i <= 65536; i++ ) { | |||||
| ftab[ i ] = 0; | ftab[ i ] = 0; | ||||
| } | |||||
| c1 = block[ 0 ]; | c1 = block[ 0 ]; | ||||
| for( i = 0; i <= last; i++ ) | for( i = 0; i <= last; i++ ) | ||||
| @@ -946,8 +986,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| c1 = c2; | c1 = c2; | ||||
| } | } | ||||
| for( i = 1; i <= 65536; i++ ) | |||||
| for( i = 1; i <= 65536; i++ ) { | |||||
| ftab[ i ] += ftab[ i - 1 ]; | ftab[ i ] += ftab[ i - 1 ]; | ||||
| } | |||||
| c1 = block[ 1 ]; | c1 = block[ 1 ]; | ||||
| for( i = 0; i < last; i++ ) | for( i = 0; i < last; i++ ) | ||||
| @@ -968,13 +1009,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| * Calculate the running order, from smallest to largest | * Calculate the running order, from smallest to largest | ||||
| * big bucket. | * big bucket. | ||||
| */ | */ | ||||
| for( i = 0; i <= 255; i++ ) | |||||
| for( i = 0; i <= 255; i++ ) { | |||||
| runningOrder[ i ] = i; | runningOrder[ i ] = i; | ||||
| } | |||||
| { | { | ||||
| int vv; | int vv; | ||||
| int h = 1; | int h = 1; | ||||
| do | |||||
| do { | |||||
| h = 3 * h + 1; | h = 3 * h + 1; | ||||
| } | |||||
| while( h <= 256 ); | while( h <= 256 ); | ||||
| do | do | ||||
| { | { | ||||
| @@ -989,8 +1032,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| runningOrder[ j ] = runningOrder[ j - h ]; | runningOrder[ j ] = runningOrder[ j - h ]; | ||||
| j = j - h; | j = j - h; | ||||
| if( j <= ( h - 1 ) ) | |||||
| if( j <= ( h - 1 ) ) { | |||||
| break; | break; | ||||
| } | |||||
| } | } | ||||
| runningOrder[ j ] = vv; | runningOrder[ j ] = vv; | ||||
| } | } | ||||
| @@ -1026,8 +1070,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| qSort3( lo, hi, 2 ); | qSort3( lo, hi, 2 ); | ||||
| numQSorted += ( hi - lo + 1 ); | numQSorted += ( hi - lo + 1 ); | ||||
| if( workDone > workLimit && firstAttempt ) | |||||
| if( workDone > workLimit && firstAttempt ) { | |||||
| return; | return; | ||||
| } | |||||
| } | } | ||||
| ftab[ sb ] |= SETMASK; | ftab[ sb ] |= SETMASK; | ||||
| } | } | ||||
| @@ -1049,28 +1094,32 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int bbSize = ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ) - bbStart; | int bbSize = ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ) - bbStart; | ||||
| int shifts = 0; | int shifts = 0; | ||||
| while( ( bbSize >> shifts ) > 65534 ) | |||||
| while( ( bbSize >> shifts ) > 65534 ) { | |||||
| shifts++; | shifts++; | ||||
| } | |||||
| for( j = 0; j < bbSize; j++ ) | for( j = 0; j < bbSize; j++ ) | ||||
| { | { | ||||
| int a2update = zptr[ bbStart + j ]; | int a2update = zptr[ bbStart + j ]; | ||||
| int qVal = ( j >> shifts ); | int qVal = ( j >> shifts ); | ||||
| quadrant[ a2update ] = qVal; | quadrant[ a2update ] = qVal; | ||||
| if( a2update < NUM_OVERSHOOT_BYTES ) | |||||
| if( a2update < NUM_OVERSHOOT_BYTES ) { | |||||
| quadrant[ a2update + last + 1 ] = qVal; | quadrant[ a2update + last + 1 ] = qVal; | ||||
| } | |||||
| } | } | ||||
| if( !( ( ( bbSize - 1 ) >> shifts ) <= 65535 ) ) | |||||
| if( !( ( ( bbSize - 1 ) >> shifts ) <= 65535 ) ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| } | } | ||||
| /* | /* | ||||
| * Now scan this big bucket so as to synthesise the | * Now scan this big bucket so as to synthesise the | ||||
| * sorted order for small buckets [t, ss] for all t != ss. | * sorted order for small buckets [t, ss] for all t != ss. | ||||
| */ | */ | ||||
| for( j = 0; j <= 255; j++ ) | |||||
| for( j = 0; j <= 255; j++ ) { | |||||
| copy[ j ] = ftab[ ( j << 8 ) + ss ] & CLEARMASK; | copy[ j ] = ftab[ ( j << 8 ) + ss ] & CLEARMASK; | ||||
| } | |||||
| for( j = ftab[ ss << 8 ] & CLEARMASK; | for( j = ftab[ ss << 8 ] & CLEARMASK; | ||||
| j < ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ); j++ ) | j < ( ftab[ ( ss + 1 ) << 8 ] & CLEARMASK ); j++ ) | ||||
| @@ -1083,8 +1132,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| } | } | ||||
| } | } | ||||
| for( j = 0; j <= 255; j++ ) | |||||
| for( j = 0; j <= 255; j++ ) { | |||||
| ftab[ ( j << 8 ) + ss ] |= SETMASK; | ftab[ ( j << 8 ) + ss ] |= SETMASK; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1093,13 +1143,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| int i; | int i; | ||||
| nInUse = 0; | nInUse = 0; | ||||
| for( i = 0; i < 256; i++ ) | |||||
| for( i = 0; i < 256; i++ ) { | |||||
| if( inUse[ i ] ) | if( inUse[ i ] ) | ||||
| { | { | ||||
| seqToUnseq[ nInUse ] = (char)i; | seqToUnseq[ nInUse ] = (char)i; | ||||
| unseqToSeq[ i ] = (char)nInUse; | unseqToSeq[ i ] = (char)nInUse; | ||||
| nInUse++; | nInUse++; | ||||
| } | } | ||||
| } | |||||
| } | } | ||||
| private char med3( char a, char b, char c ) | private char med3( char a, char b, char c ) | ||||
| @@ -1117,8 +1168,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| b = c; | b = c; | ||||
| c = t; | c = t; | ||||
| } | } | ||||
| if( a > b ) | |||||
| if( a > b ) { | |||||
| b = a; | b = a; | ||||
| } | |||||
| return b; | return b; | ||||
| } | } | ||||
| @@ -1144,8 +1196,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int hi; | int hi; | ||||
| int d; | int d; | ||||
| StackElem[] stack = new StackElem[ QSORT_STACK_SIZE ]; | StackElem[] stack = new StackElem[ QSORT_STACK_SIZE ]; | ||||
| for( int count = 0; count < QSORT_STACK_SIZE; count++ ) | |||||
| for( int count = 0; count < QSORT_STACK_SIZE; count++ ) { | |||||
| stack[ count ] = new StackElem(); | stack[ count ] = new StackElem(); | ||||
| } | |||||
| sp = 0; | sp = 0; | ||||
| @@ -1156,8 +1209,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| while( sp > 0 ) | while( sp > 0 ) | ||||
| { | { | ||||
| if( sp >= QSORT_STACK_SIZE ) | |||||
| if( sp >= QSORT_STACK_SIZE ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| sp--; | sp--; | ||||
| lo = stack[ sp ].ll; | lo = stack[ sp ].ll; | ||||
| @@ -1167,8 +1221,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| if( hi - lo < SMALL_THRESH || d > DEPTH_THRESH ) | if( hi - lo < SMALL_THRESH || d > DEPTH_THRESH ) | ||||
| { | { | ||||
| simpleSort( lo, hi, d ); | simpleSort( lo, hi, d ); | ||||
| if( workDone > workLimit && firstAttempt ) | |||||
| if( workDone > workLimit && firstAttempt ) { | |||||
| return; | return; | ||||
| } | |||||
| continue; | continue; | ||||
| } | } | ||||
| @@ -1183,8 +1238,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| if( unLo > unHi ) | |||||
| if( unLo > unHi ) { | |||||
| break; | break; | ||||
| } | |||||
| n = ( (int)block[ zptr[ unLo ] + d + 1 ] ) - med; | n = ( (int)block[ zptr[ unLo ] + d + 1 ] ) - med; | ||||
| if( n == 0 ) | if( n == 0 ) | ||||
| { | { | ||||
| @@ -1197,14 +1253,16 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| continue; | continue; | ||||
| } | } | ||||
| ; | ; | ||||
| if( n > 0 ) | |||||
| if( n > 0 ) { | |||||
| break; | break; | ||||
| } | |||||
| unLo++; | unLo++; | ||||
| } | } | ||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| if( unLo > unHi ) | |||||
| if( unLo > unHi ) { | |||||
| break; | break; | ||||
| } | |||||
| n = ( (int)block[ zptr[ unHi ] + d + 1 ] ) - med; | n = ( (int)block[ zptr[ unHi ] + d + 1 ] ) - med; | ||||
| if( n == 0 ) | if( n == 0 ) | ||||
| { | { | ||||
| @@ -1217,12 +1275,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| continue; | continue; | ||||
| } | } | ||||
| ; | ; | ||||
| if( n < 0 ) | |||||
| if( n < 0 ) { | |||||
| break; | break; | ||||
| } | |||||
| unHi--; | unHi--; | ||||
| } | } | ||||
| if( unLo > unHi ) | |||||
| if( unLo > unHi ) { | |||||
| break; | break; | ||||
| } | |||||
| int temp = 0; | int temp = 0; | ||||
| temp = zptr[ unLo ]; | temp = zptr[ unLo ]; | ||||
| zptr[ unLo ] = zptr[ unHi ]; | zptr[ unLo ] = zptr[ unHi ]; | ||||
| @@ -1270,8 +1330,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int i; | int i; | ||||
| int rNToGo = 0; | int rNToGo = 0; | ||||
| int rTPos = 0; | int rTPos = 0; | ||||
| for( i = 0; i < 256; i++ ) | |||||
| for( i = 0; i < 256; i++ ) { | |||||
| inUse[ i ] = false; | inUse[ i ] = false; | ||||
| } | |||||
| for( i = 0; i <= last; i++ ) | for( i = 0; i <= last; i++ ) | ||||
| { | { | ||||
| @@ -1279,8 +1340,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| { | { | ||||
| rNToGo = (char)RAND_NUMS[ rTPos ]; | rNToGo = (char)RAND_NUMS[ rTPos ]; | ||||
| rTPos++; | rTPos++; | ||||
| if( rTPos == 512 ) | |||||
| if( rTPos == 512 ) { | |||||
| rTPos = 0; | rTPos = 0; | ||||
| } | |||||
| } | } | ||||
| rNToGo--; | rNToGo--; | ||||
| block[ i + 1 ] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); | block[ i + 1 ] ^= ( ( rNToGo == 1 ) ? 1 : 0 ); | ||||
| @@ -1324,26 +1386,30 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int nBytes; | int nBytes; | ||||
| alphaSize = nInUse + 2; | alphaSize = nInUse + 2; | ||||
| for( t = 0; t < N_GROUPS; t++ ) | |||||
| for( v = 0; v < alphaSize; v++ ) | |||||
| for( t = 0; t < N_GROUPS; t++ ) { | |||||
| for( v = 0; v < alphaSize; v++ ) { | |||||
| len[ t ][ v ] = (char)GREATER_ICOST; | len[ t ][ v ] = (char)GREATER_ICOST; | ||||
| } | |||||
| } | |||||
| /* | /* | ||||
| * Decide how many coding tables to use | * Decide how many coding tables to use | ||||
| */ | */ | ||||
| if( nMTF <= 0 ) | |||||
| if( nMTF <= 0 ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| if( nMTF < 200 ) | |||||
| if( nMTF < 200 ) { | |||||
| nGroups = 2; | nGroups = 2; | ||||
| else if( nMTF < 600 ) | |||||
| } else if( nMTF < 600 ) { | |||||
| nGroups = 3; | nGroups = 3; | ||||
| else if( nMTF < 1200 ) | |||||
| } else if( nMTF < 1200 ) { | |||||
| nGroups = 4; | nGroups = 4; | ||||
| else if( nMTF < 2400 ) | |||||
| } else if( nMTF < 2400 ) { | |||||
| nGroups = 5; | nGroups = 5; | ||||
| else | |||||
| } else { | |||||
| nGroups = 6; | nGroups = 6; | ||||
| } | |||||
| { | { | ||||
| /* | /* | ||||
| * Generate an initial set of coding tables | * Generate an initial set of coding tables | ||||
| @@ -1374,11 +1440,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| ge--; | ge--; | ||||
| } | } | ||||
| for( v = 0; v < alphaSize; v++ ) | |||||
| if( v >= gs && v <= ge ) | |||||
| for( v = 0; v < alphaSize; v++ ) { | |||||
| if( v >= gs && v <= ge ) { | |||||
| len[ nPart - 1 ][ v ] = (char)LESSER_ICOST; | len[ nPart - 1 ][ v ] = (char)LESSER_ICOST; | ||||
| else | |||||
| } else { | |||||
| len[ nPart - 1 ][ v ] = (char)GREATER_ICOST; | len[ nPart - 1 ][ v ] = (char)GREATER_ICOST; | ||||
| } | |||||
| } | |||||
| nPart--; | nPart--; | ||||
| gs = ge + 1; | gs = ge + 1; | ||||
| @@ -1394,12 +1462,15 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| */ | */ | ||||
| for( iter = 0; iter < N_ITERS; iter++ ) | for( iter = 0; iter < N_ITERS; iter++ ) | ||||
| { | { | ||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| fave[ t ] = 0; | fave[ t ] = 0; | ||||
| } | |||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( v = 0; v < alphaSize; v++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| for( v = 0; v < alphaSize; v++ ) { | |||||
| rfreq[ t ][ v ] = 0; | rfreq[ t ][ v ] = 0; | ||||
| } | |||||
| } | |||||
| nSelectors = 0; | nSelectors = 0; | ||||
| totc = 0; | totc = 0; | ||||
| @@ -1410,18 +1481,21 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * Set group start & end marks. | * Set group start & end marks. | ||||
| */ | */ | ||||
| if( gs >= nMTF ) | |||||
| if( gs >= nMTF ) { | |||||
| break; | break; | ||||
| } | |||||
| ge = gs + G_SIZE - 1; | ge = gs + G_SIZE - 1; | ||||
| if( ge >= nMTF ) | |||||
| if( ge >= nMTF ) { | |||||
| ge = nMTF - 1; | ge = nMTF - 1; | ||||
| } | |||||
| /* | /* | ||||
| * Calculate the cost of this group as coded | * Calculate the cost of this group as coded | ||||
| * by each of the coding tables. | * by each of the coding tables. | ||||
| */ | */ | ||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| cost[ t ] = 0; | cost[ t ] = 0; | ||||
| } | |||||
| if( nGroups == 6 ) | if( nGroups == 6 ) | ||||
| { | { | ||||
| @@ -1454,8 +1528,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| for( i = gs; i <= ge; i++ ) | for( i = gs; i <= ge; i++ ) | ||||
| { | { | ||||
| short icv = szptr[ i ]; | short icv = szptr[ i ]; | ||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| cost[ t ] += len[ t ][ icv ]; | cost[ t ] += len[ t ][ icv ]; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1465,12 +1540,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| */ | */ | ||||
| bc = 999999999; | bc = 999999999; | ||||
| bt = -1; | bt = -1; | ||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| if( cost[ t ] < bc ) | if( cost[ t ] < bc ) | ||||
| { | { | ||||
| bc = cost[ t ]; | bc = cost[ t ]; | ||||
| bt = t; | bt = t; | ||||
| } | } | ||||
| } | |||||
| ; | ; | ||||
| totc += bc; | totc += bc; | ||||
| fave[ bt ]++; | fave[ bt ]++; | ||||
| @@ -1480,8 +1556,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * Increment the symbol frequencies for the selected table. | * Increment the symbol frequencies for the selected table. | ||||
| */ | */ | ||||
| for( i = gs; i <= ge; i++ ) | |||||
| for( i = gs; i <= ge; i++ ) { | |||||
| rfreq[ bt ][ szptr[ i ] ]++; | rfreq[ bt ][ szptr[ i ] ]++; | ||||
| } | |||||
| gs = ge + 1; | gs = ge + 1; | ||||
| } | } | ||||
| @@ -1489,18 +1566,21 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * Recompute the tables based on the accumulated frequencies. | * Recompute the tables based on the accumulated frequencies. | ||||
| */ | */ | ||||
| for( t = 0; t < nGroups; t++ ) | |||||
| for( t = 0; t < nGroups; t++ ) { | |||||
| hbMakeCodeLengths( len[ t ], rfreq[ t ], alphaSize, 20 ); | hbMakeCodeLengths( len[ t ], rfreq[ t ], alphaSize, 20 ); | ||||
| } | |||||
| } | } | ||||
| rfreq = null; | rfreq = null; | ||||
| fave = null; | fave = null; | ||||
| cost = null; | cost = null; | ||||
| if( !( nGroups < 8 ) ) | |||||
| if( !( nGroups < 8 ) ) { | |||||
| panic(); | panic(); | ||||
| if( !( nSelectors < 32768 && nSelectors <= ( 2 + ( 900000 / G_SIZE ) ) ) ) | |||||
| } | |||||
| if( !( nSelectors < 32768 && nSelectors <= ( 2 + ( 900000 / G_SIZE ) ) ) ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| { | { | ||||
| /* | /* | ||||
| * Compute MTF values for the selectors. | * Compute MTF values for the selectors. | ||||
| @@ -1509,8 +1589,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| char ll_i; | char ll_i; | ||||
| char tmp2; | char tmp2; | ||||
| char tmp; | char tmp; | ||||
| for( i = 0; i < nGroups; i++ ) | |||||
| for( i = 0; i < nGroups; i++ ) { | |||||
| pos[ i ] = (char)i; | pos[ i ] = (char)i; | ||||
| } | |||||
| for( i = 0; i < nSelectors; i++ ) | for( i = 0; i < nSelectors; i++ ) | ||||
| { | { | ||||
| ll_i = selector[ i ]; | ll_i = selector[ i ]; | ||||
| @@ -1539,15 +1620,19 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| maxLen = 0; | maxLen = 0; | ||||
| for( i = 0; i < alphaSize; i++ ) | for( i = 0; i < alphaSize; i++ ) | ||||
| { | { | ||||
| if( len[ t ][ i ] > maxLen ) | |||||
| if( len[ t ][ i ] > maxLen ) { | |||||
| maxLen = len[ t ][ i ]; | maxLen = len[ t ][ i ]; | ||||
| if( len[ t ][ i ] < minLen ) | |||||
| } | |||||
| if( len[ t ][ i ] < minLen ) { | |||||
| minLen = len[ t ][ i ]; | minLen = len[ t ][ i ]; | ||||
| } | |||||
| } | } | ||||
| if( maxLen > 20 ) | |||||
| if( maxLen > 20 ) { | |||||
| panic(); | panic(); | ||||
| if( minLen < 1 ) | |||||
| } | |||||
| if( minLen < 1 ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| hbAssignCodes( code[ t ], len[ t ], minLen, maxLen, alphaSize ); | hbAssignCodes( code[ t ], len[ t ], minLen, maxLen, alphaSize ); | ||||
| } | } | ||||
| { | { | ||||
| @@ -1558,25 +1643,33 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| for( i = 0; i < 16; i++ ) | for( i = 0; i < 16; i++ ) | ||||
| { | { | ||||
| inUse16[ i ] = false; | inUse16[ i ] = false; | ||||
| for( j = 0; j < 16; j++ ) | |||||
| if( inUse[ i * 16 + j ] ) | |||||
| for( j = 0; j < 16; j++ ) { | |||||
| if( inUse[ i * 16 + j ] ) { | |||||
| inUse16[ i ] = true; | inUse16[ i ] = true; | ||||
| } | |||||
| } | |||||
| } | } | ||||
| nBytes = bytesOut; | nBytes = bytesOut; | ||||
| for( i = 0; i < 16; i++ ) | |||||
| if( inUse16[ i ] ) | |||||
| for( i = 0; i < 16; i++ ) { | |||||
| if( inUse16[ i ] ) { | |||||
| bsW( 1, 1 ); | bsW( 1, 1 ); | ||||
| else | |||||
| } else { | |||||
| bsW( 1, 0 ); | bsW( 1, 0 ); | ||||
| } | |||||
| } | |||||
| for( i = 0; i < 16; i++ ) | |||||
| if( inUse16[ i ] ) | |||||
| for( j = 0; j < 16; j++ ) | |||||
| if( inUse[ i * 16 + j ] ) | |||||
| for( i = 0; i < 16; i++ ) { | |||||
| if( inUse16[ i ] ) { | |||||
| for( j = 0; j < 16; j++ ) { | |||||
| if( inUse[ i * 16 + j ] ) { | |||||
| bsW( 1, 1 ); | bsW( 1, 1 ); | ||||
| else | |||||
| } else { | |||||
| bsW( 1, 0 ); | bsW( 1, 0 ); | ||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -1588,8 +1681,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| bsW( 15, nSelectors ); | bsW( 15, nSelectors ); | ||||
| for( i = 0; i < nSelectors; i++ ) | for( i = 0; i < nSelectors; i++ ) | ||||
| { | { | ||||
| for( j = 0; j < selectorMtf[ i ]; j++ ) | |||||
| for( j = 0; j < selectorMtf[ i ]; j++ ) { | |||||
| bsW( 1, 1 ); | bsW( 1, 1 ); | ||||
| } | |||||
| bsW( 1, 0 ); | bsW( 1, 0 ); | ||||
| } | } | ||||
| @@ -1632,11 +1726,13 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| gs = 0; | gs = 0; | ||||
| while( true ) | while( true ) | ||||
| { | { | ||||
| if( gs >= nMTF ) | |||||
| if( gs >= nMTF ) { | |||||
| break; | break; | ||||
| } | |||||
| ge = gs + G_SIZE - 1; | ge = gs + G_SIZE - 1; | ||||
| if( ge >= nMTF ) | |||||
| if( ge >= nMTF ) { | |||||
| ge = nMTF - 1; | ge = nMTF - 1; | ||||
| } | |||||
| for( i = gs; i <= ge; i++ ) | for( i = gs; i <= ge; i++ ) | ||||
| { | { | ||||
| bsW( len[ selector[ selCtr ] ][ szptr[ i ] ], | bsW( len[ selector[ selCtr ] ][ szptr[ i ] ], | ||||
| @@ -1646,8 +1742,9 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| gs = ge + 1; | gs = ge + 1; | ||||
| selCtr++; | selCtr++; | ||||
| } | } | ||||
| if( !( selCtr == nSelectors ) ) | |||||
| if( !( selCtr == nSelectors ) ) { | |||||
| panic(); | panic(); | ||||
| } | |||||
| } | } | ||||
| private void simpleSort( int lo, int hi, int d ) | private void simpleSort( int lo, int hi, int d ) | ||||
| @@ -1660,12 +1757,14 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| int v; | int v; | ||||
| bigN = hi - lo + 1; | bigN = hi - lo + 1; | ||||
| if( bigN < 2 ) | |||||
| if( bigN < 2 ) { | |||||
| return; | return; | ||||
| } | |||||
| hp = 0; | hp = 0; | ||||
| while( incs[ hp ] < bigN ) | |||||
| while( incs[ hp ] < bigN ) { | |||||
| hp++; | hp++; | ||||
| } | |||||
| hp--; | hp--; | ||||
| for( ; hp >= 0; hp-- ) | for( ; hp >= 0; hp-- ) | ||||
| @@ -1678,16 +1777,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * copy 1 | * copy 1 | ||||
| */ | */ | ||||
| if( i > hi ) | |||||
| if( i > hi ) { | |||||
| break; | break; | ||||
| } | |||||
| v = zptr[ i ]; | v = zptr[ i ]; | ||||
| j = i; | j = i; | ||||
| while( fullGtU( zptr[ j - h ] + d, v + d ) ) | while( fullGtU( zptr[ j - h ] + d, v + d ) ) | ||||
| { | { | ||||
| zptr[ j ] = zptr[ j - h ]; | zptr[ j ] = zptr[ j - h ]; | ||||
| j = j - h; | j = j - h; | ||||
| if( j <= ( lo + h - 1 ) ) | |||||
| if( j <= ( lo + h - 1 ) ) { | |||||
| break; | break; | ||||
| } | |||||
| } | } | ||||
| zptr[ j ] = v; | zptr[ j ] = v; | ||||
| i++; | i++; | ||||
| @@ -1695,16 +1796,18 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * copy 2 | * copy 2 | ||||
| */ | */ | ||||
| if( i > hi ) | |||||
| if( i > hi ) { | |||||
| break; | break; | ||||
| } | |||||
| v = zptr[ i ]; | v = zptr[ i ]; | ||||
| j = i; | j = i; | ||||
| while( fullGtU( zptr[ j - h ] + d, v + d ) ) | while( fullGtU( zptr[ j - h ] + d, v + d ) ) | ||||
| { | { | ||||
| zptr[ j ] = zptr[ j - h ]; | zptr[ j ] = zptr[ j - h ]; | ||||
| j = j - h; | j = j - h; | ||||
| if( j <= ( lo + h - 1 ) ) | |||||
| if( j <= ( lo + h - 1 ) ) { | |||||
| break; | break; | ||||
| } | |||||
| } | } | ||||
| zptr[ j ] = v; | zptr[ j ] = v; | ||||
| i++; | i++; | ||||
| @@ -1712,22 +1815,25 @@ public class CBZip2OutputStream extends OutputStream implements BZip2Constants | |||||
| /* | /* | ||||
| * copy 3 | * copy 3 | ||||
| */ | */ | ||||
| if( i > hi ) | |||||
| if( i > hi ) { | |||||
| break; | break; | ||||
| } | |||||
| v = zptr[ i ]; | v = zptr[ i ]; | ||||
| j = i; | j = i; | ||||
| while( fullGtU( zptr[ j - h ] + d, v + d ) ) | while( fullGtU( zptr[ j - h ] + d, v + d ) ) | ||||
| { | { | ||||
| zptr[ j ] = zptr[ j - h ]; | zptr[ j ] = zptr[ j - h ]; | ||||
| j = j - h; | j = j - h; | ||||
| if( j <= ( lo + h - 1 ) ) | |||||
| if( j <= ( lo + h - 1 ) ) { | |||||
| break; | break; | ||||
| } | |||||
| } | } | ||||
| zptr[ j ] = v; | zptr[ j ] = v; | ||||
| i++; | i++; | ||||
| if( workDone > workLimit && firstAttempt ) | |||||
| if( workDone > workLimit && firstAttempt ) { | |||||
| return; | return; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -28,12 +28,12 @@ import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| */ | */ | ||||
| public final class Environment | public final class Environment | ||||
| { | { | ||||
| private static final String[] COMMAND_COM = new String[]{"command.com", "/c", "set"}; | |||||
| private static final String[] CMD_EXE = new String[]{"cmd", "/c", "set"}; | |||||
| private final static String[] COMMAND_COM = new String[]{"command.com", "/c", "set"}; | |||||
| private final static String[] CMD_EXE = new String[]{"cmd", "/c", "set"}; | |||||
| // Alternatively one could use: /bin/sh -c env | // Alternatively one could use: /bin/sh -c env | ||||
| private static final String[] ENV_CMD = new String[]{"/usr/bin/env"}; | |||||
| private static final String[] ENV_RAW = new String[]{"env"}; | |||||
| private final static String[] ENV_CMD = new String[]{"/usr/bin/env"}; | |||||
| private final static String[] ENV_RAW = new String[]{"env"}; | |||||
| private static Properties c_procEnvironment; | private static Properties c_procEnvironment; | ||||
| @@ -79,7 +79,7 @@ public final class Environment | |||||
| * Get the Property object with all environment variables and | * Get the Property object with all environment variables and | ||||
| * attempt to load it if it has not already been loaded. | * attempt to load it if it has not already been loaded. | ||||
| */ | */ | ||||
| private synchronized static Properties getEnvironmentVariables() | |||||
| private static synchronized Properties getEnvironmentVariables() | |||||
| throws IOException, ExecException | throws IOException, ExecException | ||||
| { | { | ||||
| if( null == c_procEnvironment ) | if( null == c_procEnvironment ) | ||||
| @@ -20,7 +20,7 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| */ | */ | ||||
| public class Os | public class Os | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Os.class ); | ResourceManager.getPackageResources( Os.class ); | ||||
| private final static String OS_NAME = | private final static String OS_NAME = | ||||
| @@ -11,7 +11,7 @@ import java.io.ByteArrayOutputStream; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import org.apache.aut.nativelib.ExecOutputHandler; | import org.apache.aut.nativelib.ExecOutputHandler; | ||||
| import org.apache.avalon.framework.logger.Logger; | |||||
| /** | /** | ||||
| * Logs each line written to this stream to the specified | * Logs each line written to this stream to the specified | ||||
| @@ -32,13 +32,13 @@ class ProcessMonitor | |||||
| private final static int SLEEP_TIME = 5; | private final static int SLEEP_TIME = 5; | ||||
| //State to indicate process is still running | //State to indicate process is still running | ||||
| private static final int STATE_RUNNING = 0; | |||||
| private final static int STATE_RUNNING = 0; | |||||
| //State to indicate process shutdown by itself | //State to indicate process shutdown by itself | ||||
| private static final int STATE_STOPPED = 1; | |||||
| private final static int STATE_STOPPED = 1; | |||||
| //State to indicate process was terminated due to timeout | //State to indicate process was terminated due to timeout | ||||
| private static final int STATE_TERMINATED = 2; | |||||
| private final static int STATE_TERMINATED = 2; | |||||
| /** | /** | ||||
| * The state of the process monitor and thus | * The state of the process monitor and thus | ||||
| @@ -244,7 +244,9 @@ class ProcessMonitor | |||||
| try | try | ||||
| { | { | ||||
| final int available = input.available(); | final int available = input.available(); | ||||
| if( 0 >= available ) return; | |||||
| if( 0 >= available ) { | |||||
| return; | |||||
| } | |||||
| final byte[] data = new byte[ available ]; | final byte[] data = new byte[ available ]; | ||||
| final int read = input.read( data ); | final int read = input.read( data ); | ||||
| @@ -11,11 +11,11 @@ import java.io.File; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.InvocationTargetException; | ||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import java.util.Properties; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.aut.nativelib.CommandLauncher; | import org.apache.aut.nativelib.CommandLauncher; | ||||
| import org.apache.aut.nativelib.Environment; | |||||
| import org.apache.aut.nativelib.ExecException; | import org.apache.aut.nativelib.ExecException; | ||||
| import org.apache.aut.nativelib.ExecMetaData; | import org.apache.aut.nativelib.ExecMetaData; | ||||
| @@ -31,10 +31,10 @@ import org.apache.aut.nativelib.ExecMetaData; | |||||
| public class DefaultCommandLauncher | public class DefaultCommandLauncher | ||||
| implements CommandLauncher | implements CommandLauncher | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultCommandLauncher.class ); | ResourceManager.getPackageResources( DefaultCommandLauncher.class ); | ||||
| private static final Method c_execWithCWD; | |||||
| private final static Method c_execWithCWD; | |||||
| static | static | ||||
| { | { | ||||
| @@ -27,7 +27,7 @@ class ExecUtil | |||||
| /** | /** | ||||
| * The file representing the current working directory. | * The file representing the current working directory. | ||||
| */ | */ | ||||
| private static final File c_cwd; | |||||
| private final static File c_cwd; | |||||
| static | static | ||||
| { | { | ||||
| @@ -28,7 +28,7 @@ import org.apache.myrmidon.interfaces.aspect.AspectManager; | |||||
| public class DefaultAspectManager | public class DefaultAspectManager | ||||
| implements AspectManager, Initializable | implements AspectManager, Initializable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultAspectManager.class ); | ResourceManager.getPackageResources( DefaultAspectManager.class ); | ||||
| private HashMap m_aspectMap = new HashMap(); | private HashMap m_aspectMap = new HashMap(); | ||||
| @@ -33,7 +33,7 @@ public class ATIProjectBuilder | |||||
| extends DefaultProjectBuilder | extends DefaultProjectBuilder | ||||
| implements Parameterizable | implements Parameterizable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( ATIProjectBuilder.class ); | ResourceManager.getPackageResources( ATIProjectBuilder.class ); | ||||
| private Parameters m_parameters; | private Parameters m_parameters; | ||||
| @@ -74,11 +74,11 @@ public class ATIProjectBuilder | |||||
| final String target = reactorHandler.getTarget( i ); | final String target = reactorHandler.getTarget( i ); | ||||
| final String data = reactorHandler.getData( i ); | final String data = reactorHandler.getData( i ); | ||||
| if( target.equals( "xsl-param" ) ) | |||||
| if( target.equals( "xsl-param" ) ) { | |||||
| handleParameter( data ); | handleParameter( data ); | ||||
| else if( target.equals( "xsl-params" ) ) | |||||
| } else if( target.equals( "xsl-params" ) ) { | |||||
| handleParameters( data, sourceID ); | handleParameters( data, sourceID ); | ||||
| else if( target.equals( "xsl-stylesheet" ) ) | |||||
| } else if( target.equals( "xsl-stylesheet" ) ) | |||||
| { | { | ||||
| if( null != transformer ) | if( null != transformer ) | ||||
| { | { | ||||
| @@ -17,7 +17,7 @@ import org.apache.avalon.excalibur.i18n.ResourceManager; | |||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
| import org.apache.avalon.framework.CascadingException; | import org.apache.avalon.framework.CascadingException; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | |||||
| import org.apache.avalon.framework.Version; | import org.apache.avalon.framework.Version; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| @@ -40,7 +40,7 @@ public class DefaultProjectBuilder | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements ProjectBuilder | implements ProjectBuilder | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultProjectBuilder.class ); | ResourceManager.getPackageResources( DefaultProjectBuilder.class ); | ||||
| private final static Version VERSION = new Version( 2, 0, 0 ); | private final static Version VERSION = new Version( 2, 0, 0 ); | ||||
| @@ -263,9 +263,9 @@ public class DefaultProjectBuilder | |||||
| } | } | ||||
| } | } | ||||
| if( name.equals( "target" ) ) | |||||
| if( name.equals( "target" ) ) { | |||||
| buildTarget( project, element ); | buildTarget( project, element ); | ||||
| else | |||||
| } else | |||||
| { | { | ||||
| final String message = | final String message = | ||||
| REZ.getString( "ant.unknown-toplevel-element.error", name, element.getLocation() ); | REZ.getString( "ant.unknown-toplevel-element.error", name, element.getLocation() ); | ||||
| @@ -456,9 +456,10 @@ public class DefaultProjectBuilder | |||||
| protected boolean validName( final String name ) | protected boolean validName( final String name ) | ||||
| { | { | ||||
| if( -1 != name.indexOf( "->" ) ) | |||||
| if( -1 != name.indexOf( "->" ) ) { | |||||
| return false; | return false; | ||||
| else | |||||
| } else { | |||||
| return true; | return true; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -34,7 +34,7 @@ public class DefaultConfigurer | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements Configurer, Composable, LogEnabled | implements Configurer, Composable, LogEnabled | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultConfigurer.class ); | ResourceManager.getPackageResources( DefaultConfigurer.class ); | ||||
| ///Compile time constant to turn on extreme debugging | ///Compile time constant to turn on extreme debugging | ||||
| @@ -13,7 +13,14 @@ import org.apache.avalon.framework.configuration.ConfigurationException; | |||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||
| import java.lang.reflect.Modifier; | import java.lang.reflect.Modifier; | ||||
| import java.util.*; | |||||
| import java.util.Map; | |||||
| import java.util.HashMap; | |||||
| import java.util.Set; | |||||
| import java.util.HashSet; | |||||
| import java.util.Iterator; | |||||
| import java.util.List; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Collection; | |||||
| /** | /** | ||||
| * An object configurer which uses reflection to determine the properties | * An object configurer which uses reflection to determine the properties | ||||
| @@ -25,7 +32,7 @@ import java.util.*; | |||||
| public class DefaultObjectConfigurer | public class DefaultObjectConfigurer | ||||
| implements ObjectConfigurer | implements ObjectConfigurer | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultObjectConfigurer.class ); | ResourceManager.getPackageResources( DefaultObjectConfigurer.class ); | ||||
| private final Class m_class; | private final Class m_class; | ||||
| @@ -24,7 +24,7 @@ import java.lang.reflect.Method; | |||||
| class DefaultPropertyConfigurer | class DefaultPropertyConfigurer | ||||
| implements PropertyConfigurer | implements PropertyConfigurer | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultPropertyConfigurer.class ); | ResourceManager.getPackageResources( DefaultPropertyConfigurer.class ); | ||||
| private final Class m_type; | private final Class m_type; | ||||
| @@ -23,7 +23,9 @@ public class DefaultConverterRegistry | |||||
| public String getConverterName( final String source, final String destination ) | public String getConverterName( final String source, final String destination ) | ||||
| { | { | ||||
| final HashMap map = (HashMap)m_mapping.get( source ); | final HashMap map = (HashMap)m_mapping.get( source ); | ||||
| if( null == map ) return null; | |||||
| if( null == map ) { | |||||
| return null; | |||||
| } | |||||
| return (String)map.get( destination ); | return (String)map.get( destination ); | ||||
| } | } | ||||
| @@ -31,7 +31,7 @@ public class DefaultMasterConverter | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements MasterConverter, Composable | implements MasterConverter, Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultMasterConverter.class ); | ResourceManager.getPackageResources( DefaultMasterConverter.class ); | ||||
| private final static boolean DEBUG = false; | private final static boolean DEBUG = false; | ||||
| @@ -51,7 +51,7 @@ public class DefaultDeployer | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements Deployer, Initializable, Composable | implements Deployer, Initializable, Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultDeployer.class ); | ResourceManager.getPackageResources( DefaultDeployer.class ); | ||||
| private final static String TYPE_DESCRIPTOR = "META-INF/ant-types.xml"; | private final static String TYPE_DESCRIPTOR = "META-INF/ant-types.xml"; | ||||
| @@ -28,7 +28,7 @@ import org.xml.sax.XMLReader; | |||||
| */ | */ | ||||
| public class Deployment | public class Deployment | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Deployment.class ); | ResourceManager.getPackageResources( Deployment.class ); | ||||
| public final static String DESCRIPTOR_NAME = "META-INF/ant-descriptor.xml"; | public final static String DESCRIPTOR_NAME = "META-INF/ant-descriptor.xml"; | ||||
| @@ -46,7 +46,7 @@ public class DefaultEmbeddor | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements Embeddor | implements Embeddor | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultEmbeddor.class ); | ResourceManager.getPackageResources( DefaultEmbeddor.class ); | ||||
| private Deployer m_deployer; | private Deployer m_deployer; | ||||
| @@ -499,7 +499,9 @@ public class DefaultEmbeddor | |||||
| final String filename = files[ i ].getName(); | final String filename = files[ i ].getName(); | ||||
| int index = filename.lastIndexOf( '.' ); | int index = filename.lastIndexOf( '.' ); | ||||
| if( -1 == index ) index = filename.length(); | |||||
| if( -1 == index ) { | |||||
| index = filename.length(); | |||||
| } | |||||
| final String name = filename.substring( 0, index ); | final String name = filename.substring( 0, index ); | ||||
| @@ -26,7 +26,7 @@ import org.apache.myrmidon.interfaces.executor.ExecutionFrame; | |||||
| public class AspectAwareExecutor | public class AspectAwareExecutor | ||||
| extends DefaultExecutor | extends DefaultExecutor | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( AspectAwareExecutor.class ); | ResourceManager.getPackageResources( AspectAwareExecutor.class ); | ||||
| private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | private final static Configuration[] EMPTY_ELEMENTS = new Configuration[ 0 ]; | ||||
| @@ -139,12 +139,14 @@ public class AspectAwareExecutor | |||||
| final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); | final ArrayList elementList = (ArrayList)elementMap.remove( names[ i ] ); | ||||
| Parameters parameters = (Parameters)parameterMap.remove( names[ i ] ); | Parameters parameters = (Parameters)parameterMap.remove( names[ i ] ); | ||||
| if( null == parameters ) parameters = Parameters.EMPTY_PARAMETERS; | |||||
| if( null == parameters ) { | |||||
| parameters = Parameters.EMPTY_PARAMETERS; | |||||
| } | |||||
| Configuration[] elements = null; | Configuration[] elements = null; | ||||
| if( null == elementList ) | |||||
| if( null == elementList ) { | |||||
| elements = EMPTY_ELEMENTS; | elements = EMPTY_ELEMENTS; | ||||
| else | |||||
| } else | |||||
| { | { | ||||
| elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
| } | } | ||||
| @@ -170,9 +172,9 @@ public class AspectAwareExecutor | |||||
| Configuration[] elements = null; | Configuration[] elements = null; | ||||
| if( null == elementList ) | |||||
| if( null == elementList ) { | |||||
| elements = EMPTY_ELEMENTS; | elements = EMPTY_ELEMENTS; | ||||
| else | |||||
| } else | |||||
| { | { | ||||
| elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | elements = (Configuration[])elementList.toArray( EMPTY_ELEMENTS ); | ||||
| } | } | ||||
| @@ -30,7 +30,7 @@ public class DefaultExecutor | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements Executor, Composable | implements Executor, Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultExecutor.class ); | ResourceManager.getPackageResources( DefaultExecutor.class ); | ||||
| private Configurer m_configurer; | private Configurer m_configurer; | ||||
| @@ -24,7 +24,7 @@ import org.apache.myrmidon.interfaces.model.TypeLib; | |||||
| public class DefaultProject | public class DefaultProject | ||||
| implements Project | implements Project | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultProject.class ); | ResourceManager.getPackageResources( DefaultProject.class ); | ||||
| ///The imports | ///The imports | ||||
| @@ -30,7 +30,7 @@ import org.xml.sax.XMLReader; | |||||
| public class DefaultRoleManager | public class DefaultRoleManager | ||||
| implements RoleManager, Initializable | implements RoleManager, Initializable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultRoleManager.class ); | ResourceManager.getPackageResources( DefaultRoleManager.class ); | ||||
| private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | private final static String ROLE_DESCRIPTOR = "META-INF/ant-roles.xml"; | ||||
| @@ -22,7 +22,7 @@ import org.apache.myrmidon.interfaces.type.TypeManager; | |||||
| public class DefaultTypeManager | public class DefaultTypeManager | ||||
| implements TypeManager | implements TypeManager | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultTypeManager.class ); | ResourceManager.getPackageResources( DefaultTypeManager.class ); | ||||
| ///Parent type manager to inherit values from. | ///Parent type manager to inherit values from. | ||||
| @@ -21,7 +21,7 @@ import org.apache.myrmidon.interfaces.type.TypeFactory; | |||||
| public class MultiSourceTypeFactory | public class MultiSourceTypeFactory | ||||
| implements TypeFactory | implements TypeFactory | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); | ResourceManager.getPackageResources( MultiSourceTypeFactory.class ); | ||||
| ///Parent Selector | ///Parent Selector | ||||
| @@ -28,7 +28,7 @@ public class DefaultTaskContext | |||||
| extends DefaultContext | extends DefaultContext | ||||
| implements TaskContext | implements TaskContext | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultTaskContext.class ); | ResourceManager.getPackageResources( DefaultTaskContext.class ); | ||||
| /** | /** | ||||
| @@ -178,9 +178,9 @@ public class DefaultTaskContext | |||||
| { | { | ||||
| checkPropertyValid( name, value ); | checkPropertyValid( name, value ); | ||||
| if( CURRENT == scope ) | |||||
| if( CURRENT == scope ) { | |||||
| put( name, value ); | put( name, value ); | ||||
| else if( PARENT == scope ) | |||||
| } else if( PARENT == scope ) | |||||
| { | { | ||||
| if( null == getParent() ) | if( null == getParent() ) | ||||
| { | { | ||||
| @@ -52,7 +52,7 @@ public class DefaultWorkspace | |||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| implements Workspace, Composable, Parameterizable, Initializable | implements Workspace, Composable, Parameterizable, Initializable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultWorkspace.class ); | ResourceManager.getPackageResources( DefaultWorkspace.class ); | ||||
| private Executor m_executor; | private Executor m_executor; | ||||
| @@ -50,7 +50,9 @@ public class ProjectListenerSupport | |||||
| } | } | ||||
| } | } | ||||
| if( -1 == found ) return; | |||||
| if( -1 == found ) { | |||||
| return; | |||||
| } | |||||
| final ProjectListener[] listeners = new ProjectListener[ m_listeners.length - 1 ]; | final ProjectListener[] listeners = new ProjectListener[ m_listeners.length - 1 ]; | ||||
| System.arraycopy( m_listeners, 0, listeners, 0, found ); | System.arraycopy( m_listeners, 0, listeners, 0, found ); | ||||
| @@ -19,7 +19,7 @@ import org.apache.avalon.framework.context.Context; | |||||
| public abstract class AbstractConverter | public abstract class AbstractConverter | ||||
| implements Converter | implements Converter | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( AbstractConverter.class ); | ResourceManager.getPackageResources( AbstractConverter.class ); | ||||
| private final Class m_source; | private final Class m_source; | ||||
| @@ -9,14 +9,14 @@ package org.apache.myrmidon.framework; | |||||
| import org.apache.avalon.excalibur.i18n.ResourceManager; | import org.apache.avalon.excalibur.i18n.ResourceManager; | ||||
| import org.apache.avalon.excalibur.i18n.Resources; | import org.apache.avalon.excalibur.i18n.Resources; | ||||
| import org.apache.avalon.excalibur.property.PropertyException; | |||||
| import org.apache.avalon.excalibur.property.PropertyUtil; | |||||
| import org.apache.avalon.framework.component.ComponentException; | import org.apache.avalon.framework.component.ComponentException; | ||||
| import org.apache.avalon.framework.component.ComponentManager; | import org.apache.avalon.framework.component.ComponentManager; | ||||
| import org.apache.avalon.framework.component.Composable; | import org.apache.avalon.framework.component.Composable; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.avalon.framework.context.Context; | |||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.converter.Converter; | import org.apache.myrmidon.converter.Converter; | ||||
| import org.apache.myrmidon.converter.ConverterException; | import org.apache.myrmidon.converter.ConverterException; | ||||
| @@ -33,7 +33,7 @@ public abstract class AbstractContainerTask | |||||
| extends AbstractTask | extends AbstractTask | ||||
| implements Composable | implements Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( AbstractContainerTask.class ); | ResourceManager.getPackageResources( AbstractContainerTask.class ); | ||||
| ///For converting own attributes | ///For converting own attributes | ||||
| @@ -33,7 +33,7 @@ public abstract class AbstractTypeDef | |||||
| extends AbstractTask | extends AbstractTask | ||||
| implements Composable | implements Composable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( AbstractTypeDef.class ); | ResourceManager.getPackageResources( AbstractTypeDef.class ); | ||||
| private File m_lib; | private File m_lib; | ||||
| @@ -23,7 +23,7 @@ import org.apache.avalon.framework.context.ContextException; | |||||
| public class Condition | public class Condition | ||||
| implements Component | implements Component | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Condition.class ); | ResourceManager.getPackageResources( Condition.class ); | ||||
| private String m_condition; | private String m_condition; | ||||
| @@ -22,7 +22,7 @@ public final class LogLevel | |||||
| extends Enum | extends Enum | ||||
| { | { | ||||
| //Map for all the levels | //Map for all the levels | ||||
| private static final HashMap c_levels = new HashMap(); | |||||
| private final static HashMap c_levels = new HashMap(); | |||||
| //standard enums for version of JVM | //standard enums for version of JVM | ||||
| public final static LogLevel FATAL_ERROR = new LogLevel( "fatalError" ); | public final static LogLevel FATAL_ERROR = new LogLevel( "fatalError" ); | ||||
| @@ -19,7 +19,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| public class Pattern | public class Pattern | ||||
| implements DataType | implements DataType | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( Pattern.class ); | ResourceManager.getPackageResources( Pattern.class ); | ||||
| private String m_value; | private String m_value; | ||||
| @@ -85,7 +85,9 @@ public class Pattern | |||||
| public String toString() | public String toString() | ||||
| { | { | ||||
| String result = "Pattern['" + m_value + "',"; | String result = "Pattern['" + m_value + "',"; | ||||
| if( null != m_condition ) result = result + m_condition; | |||||
| if( null != m_condition ) { | |||||
| result = result + m_condition; | |||||
| } | |||||
| return result + "]"; | return result + "]"; | ||||
| } | } | ||||
| @@ -30,7 +30,7 @@ public class TypeInstanceTask | |||||
| extends AbstractContainerTask | extends AbstractContainerTask | ||||
| implements Configurable | implements Configurable | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( TypeInstanceTask.class ); | ResourceManager.getPackageResources( TypeInstanceTask.class ); | ||||
| private String m_id; | private String m_id; | ||||
| @@ -50,28 +50,28 @@ import org.apache.myrmidon.listeners.ProjectListener; | |||||
| public class CLIMain | public class CLIMain | ||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( CLIMain.class ); | ResourceManager.getPackageResources( CLIMain.class ); | ||||
| private static final String PATTERN = "[%8.8{category}] %{message}\\n%{throwable}"; | |||||
| private final static String PATTERN = "[%8.8{category}] %{message}\\n%{throwable}"; | |||||
| //defines for the Command Line options | //defines for the Command Line options | ||||
| private static final int HELP_OPT = 'h'; | |||||
| private static final int QUIET_OPT = 'q'; | |||||
| private static final int VERBOSE_OPT = 'v'; | |||||
| private static final int FILE_OPT = 'f'; | |||||
| private static final int LOG_LEVEL_OPT = 'l'; | |||||
| private static final int DEFINE_OPT = 'D'; | |||||
| private static final int BUILDER_PARAM_OPT = 'B'; | |||||
| private static final int VERSION_OPT = 1; | |||||
| private static final int LISTENER_OPT = 2; | |||||
| private static final int TASKLIB_DIR_OPT = 5; | |||||
| private static final int INCREMENTAL_OPT = 6; | |||||
| private static final int HOME_DIR_OPT = 7; | |||||
| private static final int DRY_RUN_OPT = 8; | |||||
| private final static int HELP_OPT = 'h'; | |||||
| private final static int QUIET_OPT = 'q'; | |||||
| private final static int VERBOSE_OPT = 'v'; | |||||
| private final static int FILE_OPT = 'f'; | |||||
| private final static int LOG_LEVEL_OPT = 'l'; | |||||
| private final static int DEFINE_OPT = 'D'; | |||||
| private final static int BUILDER_PARAM_OPT = 'B'; | |||||
| private final static int VERSION_OPT = 1; | |||||
| private final static int LISTENER_OPT = 2; | |||||
| private final static int TASKLIB_DIR_OPT = 5; | |||||
| private final static int INCREMENTAL_OPT = 6; | |||||
| private final static int HOME_DIR_OPT = 7; | |||||
| private final static int DRY_RUN_OPT = 8; | |||||
| //incompatable options for info options | //incompatable options for info options | ||||
| private static final int[] INFO_OPT_INCOMPAT = new int[] | |||||
| private final static int[] INFO_OPT_INCOMPAT = new int[] | |||||
| { | { | ||||
| HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT, | HELP_OPT, QUIET_OPT, VERBOSE_OPT, FILE_OPT, | ||||
| LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT, | LOG_LEVEL_OPT, VERSION_OPT, LISTENER_OPT, | ||||
| @@ -79,7 +79,7 @@ public class CLIMain | |||||
| }; | }; | ||||
| //incompatable options for other logging options | //incompatable options for other logging options | ||||
| private static final int[] LOG_OPT_INCOMPAT = new int[] | |||||
| private final static int[] LOG_OPT_INCOMPAT = new int[] | |||||
| { | { | ||||
| QUIET_OPT, VERBOSE_OPT, LOG_LEVEL_OPT | QUIET_OPT, VERBOSE_OPT, LOG_LEVEL_OPT | ||||
| }; | }; | ||||
| @@ -383,7 +383,9 @@ public class CLIMain | |||||
| doBuild( workspace, project, m_targets ); | doBuild( workspace, project, m_targets ); | ||||
| if( !incremental ) break; | |||||
| if( !incremental ) { | |||||
| break; | |||||
| } | |||||
| final String message = REZ.getString( "repeat.notice" ); | final String message = REZ.getString( "repeat.notice" ); | ||||
| System.out.println( message ); | System.out.println( message ); | ||||
| @@ -395,7 +397,9 @@ public class CLIMain | |||||
| String line = reader.readLine(); | String line = reader.readLine(); | ||||
| if( line.equalsIgnoreCase( "no" ) ) break; | |||||
| if( line.equalsIgnoreCase( "no" ) ) { | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| @@ -22,7 +22,7 @@ import org.apache.avalon.excalibur.i18n.Resources; | |||||
| public class DefaultTypeFactory | public class DefaultTypeFactory | ||||
| implements TypeFactory | implements TypeFactory | ||||
| { | { | ||||
| private static final Resources REZ = | |||||
| private final static Resources REZ = | |||||
| ResourceManager.getPackageResources( DefaultTypeFactory.class ); | ResourceManager.getPackageResources( DefaultTypeFactory.class ); | ||||
| ///A Map of shortnames to classnames | ///A Map of shortnames to classnames | ||||
| @@ -28,7 +28,7 @@ public final class Main | |||||
| * @param args the CLI arguments | * @param args the CLI arguments | ||||
| * @exception Exception if an error occurs | * @exception Exception if an error occurs | ||||
| */ | */ | ||||
| public final static void main( final String[] args ) | |||||
| public static final void main( final String[] args ) | |||||
| throws Exception | throws Exception | ||||
| { | { | ||||
| try | try | ||||
| @@ -69,7 +69,7 @@ public final class Main | |||||
| } | } | ||||
| } | } | ||||
| private final static URL[] buildURLList( final File dir ) | |||||
| private static final URL[] buildURLList( final File dir ) | |||||
| throws Exception | throws Exception | ||||
| { | { | ||||
| final ArrayList urlList = new ArrayList(); | final ArrayList urlList = new ArrayList(); | ||||
| @@ -109,7 +109,7 @@ public final class Main | |||||
| /** | /** | ||||
| * Finds the myrmidon.jar file in the classpath. | * Finds the myrmidon.jar file in the classpath. | ||||
| */ | */ | ||||
| private final static File findInstallDir() | |||||
| private static final File findInstallDir() | |||||
| throws Exception | throws Exception | ||||
| { | { | ||||
| final String classpath = System.getProperty( "java.class.path" ); | final String classpath = System.getProperty( "java.class.path" ); | ||||
| @@ -96,8 +96,9 @@ public class Project | |||||
| */ | */ | ||||
| public String getProperty( String name ) | public String getProperty( String name ) | ||||
| { | { | ||||
| if( name == null ) | |||||
| if( name == null ) { | |||||
| return null; | return null; | ||||
| } | |||||
| String property = (String)properties.get( name ); | String property = (String)properties.get( name ); | ||||
| return property; | return property; | ||||
| } | } | ||||
| @@ -13,7 +13,7 @@ import java.net.URLClassLoader; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.condition.Condition; | import org.apache.tools.ant.taskdefs.condition.Condition; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
| @@ -239,8 +239,9 @@ public class Get extends Task | |||||
| if( is == null ) | if( is == null ) | ||||
| { | { | ||||
| getLogger().info( "Can't get " + source + " to " + dest ); | getLogger().info( "Can't get " + source + " to " + dest ); | ||||
| if( ignoreErrors ) | |||||
| if( ignoreErrors ) { | |||||
| return; | return; | ||||
| } | |||||
| throw new TaskException( "Can't get " + source + " to " + dest ); | throw new TaskException( "Can't get " + source + " to " + dest ); | ||||
| } | } | ||||
| @@ -250,11 +251,13 @@ public class Get extends Task | |||||
| while( ( length = is.read( buffer ) ) >= 0 ) | while( ( length = is.read( buffer ) ) >= 0 ) | ||||
| { | { | ||||
| fos.write( buffer, 0, length ); | fos.write( buffer, 0, length ); | ||||
| if( verbose ) | |||||
| if( verbose ) { | |||||
| System.out.print( "." ); | System.out.print( "." ); | ||||
| } | |||||
| } | } | ||||
| if( verbose ) | |||||
| if( verbose ) { | |||||
| System.out.println(); | System.out.println(); | ||||
| } | |||||
| fos.close(); | fos.close(); | ||||
| is.close(); | is.close(); | ||||
| @@ -279,8 +282,9 @@ public class Get extends Task | |||||
| catch( IOException ioe ) | catch( IOException ioe ) | ||||
| { | { | ||||
| getLogger().info( "Error getting " + source + " to " + dest ); | getLogger().info( "Error getting " + source + " to " + dest ); | ||||
| if( ignoreErrors ) | |||||
| if( ignoreErrors ) { | |||||
| return; | return; | ||||
| } | |||||
| throw new TaskException( "Error", ioe ); | throw new TaskException( "Error", ioe ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -13,7 +13,7 @@ import java.io.PrintStream; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -149,8 +149,9 @@ public class PathConvert extends Task | |||||
| elem = elem.replace( fromDirSep, toDirSep ); | elem = elem.replace( fromDirSep, toDirSep ); | ||||
| if( i != 0 ) | |||||
| if( i != 0 ) { | |||||
| rslt.append( m_pathSep ); | rslt.append( m_pathSep ); | ||||
| } | |||||
| rslt.append( elem ); | rslt.append( elem ); | ||||
| } | } | ||||
| @@ -209,16 +210,19 @@ public class PathConvert extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( m_path == null ) | |||||
| if( m_path == null ) { | |||||
| throw new TaskException( "You must specify a path to convert" ); | throw new TaskException( "You must specify a path to convert" ); | ||||
| } | |||||
| if( m_property == null ) | |||||
| if( m_property == null ) { | |||||
| throw new TaskException( "You must specify a property" ); | throw new TaskException( "You must specify a property" ); | ||||
| } | |||||
| // Must either have a target OS or both a dirSep and pathSep | // Must either have a target OS or both a dirSep and pathSep | ||||
| if( m_targetOS == null && m_pathSep == null && m_dirSep == null ) | |||||
| if( m_targetOS == null && m_pathSep == null && m_dirSep == null ) { | |||||
| throw new TaskException( "You must specify at least one of targetOS, dirSep, or pathSep" ); | throw new TaskException( "You must specify at least one of targetOS, dirSep, or pathSep" ); | ||||
| } | |||||
| // Determine the separator strings. The dirsep and pathsep attributes | // Determine the separator strings. The dirsep and pathsep attributes | ||||
| // override the targetOS settings. | // override the targetOS settings. | ||||
| @@ -79,8 +79,9 @@ public class Property | |||||
| setProperty( m_name, m_value ); | setProperty( m_name, m_value ); | ||||
| } | } | ||||
| if( m_resource != null ) | |||||
| if( m_resource != null ) { | |||||
| loadResource( m_resource ); | loadResource( m_resource ); | ||||
| } | |||||
| } | } | ||||
| private void validate() throws TaskException | private void validate() throws TaskException | ||||
| @@ -468,8 +468,9 @@ public class SQLExec | |||||
| throw new SQLException( "No suitable Driver for " + url ); | throw new SQLException( "No suitable Driver for " + url ); | ||||
| } | } | ||||
| if( !isValidRdbms( conn ) ) | |||||
| if( !isValidRdbms( conn ) ) { | |||||
| return; | return; | ||||
| } | |||||
| conn.setAutoCommit( autocommit ); | conn.setAutoCommit( autocommit ); | ||||
| @@ -563,8 +564,9 @@ public class SQLExec | |||||
| */ | */ | ||||
| protected boolean isValidRdbms( Connection conn ) | protected boolean isValidRdbms( Connection conn ) | ||||
| { | { | ||||
| if( rdbms == null && version == null ) | |||||
| if( rdbms == null && version == null ) { | |||||
| return true; | return true; | ||||
| } | |||||
| try | try | ||||
| { | { | ||||
| @@ -617,8 +619,9 @@ public class SQLExec | |||||
| throws SQLException | throws SQLException | ||||
| { | { | ||||
| // Check and ignore empty statements | // Check and ignore empty statements | ||||
| if( "".equals( sql.trim() ) ) | |||||
| if( "".equals( sql.trim() ) ) { | |||||
| return; | return; | ||||
| } | |||||
| try | try | ||||
| { | { | ||||
| @@ -647,8 +650,9 @@ public class SQLExec | |||||
| catch( SQLException e ) | catch( SQLException e ) | ||||
| { | { | ||||
| getLogger().error( "Failed to execute: " + sql ); | getLogger().error( "Failed to execute: " + sql ); | ||||
| if( !onError.equals( "continue" ) ) | |||||
| if( !onError.equals( "continue" ) ) { | |||||
| throw e; | throw e; | ||||
| } | |||||
| getLogger().error( e.toString() ); | getLogger().error( e.toString() ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -726,10 +730,12 @@ public class SQLExec | |||||
| { | { | ||||
| line = line.trim(); | line = line.trim(); | ||||
| line = "" + resolveValue( line ); | line = "" + resolveValue( line ); | ||||
| if( line.startsWith( "//" ) ) | |||||
| if( line.startsWith( "//" ) ) { | |||||
| continue; | continue; | ||||
| if( line.startsWith( "--" ) ) | |||||
| } | |||||
| if( line.startsWith( "--" ) ) { | |||||
| continue; | continue; | ||||
| } | |||||
| StringTokenizer st = new StringTokenizer( line ); | StringTokenizer st = new StringTokenizer( line ); | ||||
| if( st.hasMoreTokens() ) | if( st.hasMoreTokens() ) | ||||
| { | { | ||||
| @@ -746,8 +752,9 @@ public class SQLExec | |||||
| // SQL defines "--" as a comment to EOL | // SQL defines "--" as a comment to EOL | ||||
| // and in Oracle it may contain a hint | // and in Oracle it may contain a hint | ||||
| // so we cannot just remove it, instead we must end it | // so we cannot just remove it, instead we must end it | ||||
| if( line.indexOf( "--" ) >= 0 ) | |||||
| if( line.indexOf( "--" ) >= 0 ) { | |||||
| sql += "\n"; | sql += "\n"; | ||||
| } | |||||
| if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) || | if( delimiterType.equals( DelimiterType.NORMAL ) && sql.endsWith( delimiter ) || | ||||
| delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) ) | delimiterType.equals( DelimiterType.ROW ) && line.equals( delimiter ) ) | ||||
| @@ -14,9 +14,9 @@ import java.io.IOException; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | |||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | |||||
| import org.apache.tools.ant.types.FileSet; | |||||
| import org.apache.tools.ant.util.mappers.MergingMapper; | import org.apache.tools.ant.util.mappers.MergingMapper; | ||||
| import org.apache.tools.ant.types.SourceFileScanner; | import org.apache.tools.ant.types.SourceFileScanner; | ||||
| import org.apache.aut.tar.TarConstants; | import org.apache.aut.tar.TarConstants; | ||||
| @@ -304,8 +304,9 @@ public class Tar | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| if( input != null ) | |||||
| if( input != null ) { | |||||
| input.close(); | input.close(); | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -119,8 +119,9 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| } | } | ||||
| // if not there then it can't be up to date | // if not there then it can't be up to date | ||||
| if( _targetFile != null && !_targetFile.exists() ) | |||||
| if( _targetFile != null && !_targetFile.exists() ) { | |||||
| return false; | return false; | ||||
| } | |||||
| Iterator enum = sourceFileSets.iterator(); | Iterator enum = sourceFileSets.iterator(); | ||||
| boolean upToDate = true; | boolean upToDate = true; | ||||
| @@ -349,8 +349,9 @@ public class Zip | |||||
| // before we added any files, then we must swallow this exception. Otherwise, | // before we added any files, then we must swallow this exception. Otherwise, | ||||
| // the error that's reported will be the close() error, which is not the real | // the error that's reported will be the close() error, which is not the real | ||||
| // cause of the problem. | // cause of the problem. | ||||
| if( success ) | |||||
| if( success ) { | |||||
| throw ex; | throw ex; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -455,8 +456,9 @@ public class Zip | |||||
| } | } | ||||
| } | } | ||||
| if( !zipFile.exists() ) | |||||
| if( !zipFile.exists() ) { | |||||
| return false; | return false; | ||||
| } | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | final SourceFileScanner scanner = new SourceFileScanner(); | ||||
| setupLogger( scanner ); | setupLogger( scanner ); | ||||
| @@ -490,15 +492,17 @@ public class Zip | |||||
| String prefix, String fullpath ) | String prefix, String fullpath ) | ||||
| throws IOException, TaskException | throws IOException, TaskException | ||||
| { | { | ||||
| if( prefix.length() > 0 && fullpath.length() > 0 ) | |||||
| if( prefix.length() > 0 && fullpath.length() > 0 ) { | |||||
| throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
| } | |||||
| File thisBaseDir = scanner.getBasedir(); | File thisBaseDir = scanner.getBasedir(); | ||||
| // directories that matched include patterns | // directories that matched include patterns | ||||
| String[] dirs = scanner.getIncludedDirectories(); | String[] dirs = scanner.getIncludedDirectories(); | ||||
| if( dirs.length > 0 && fullpath.length() > 0 ) | |||||
| if( dirs.length > 0 && fullpath.length() > 0 ) { | |||||
| throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); | throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); | ||||
| } | |||||
| for( int i = 0; i < dirs.length; i++ ) | for( int i = 0; i < dirs.length; i++ ) | ||||
| { | { | ||||
| if( "".equals( dirs[ i ] ) ) | if( "".equals( dirs[ i ] ) ) | ||||
| @@ -515,8 +519,9 @@ public class Zip | |||||
| // files that matched include patterns | // files that matched include patterns | ||||
| String[] files = scanner.getIncludedFiles(); | String[] files = scanner.getIncludedFiles(); | ||||
| if( files.length > 1 && fullpath.length() > 0 ) | |||||
| if( files.length > 1 && fullpath.length() > 0 ) { | |||||
| throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); | throw new TaskException( "fullpath attribute may only be specified for filesets that specify a single file." ); | ||||
| } | |||||
| for( int i = 0; i < files.length; i++ ) | for( int i = 0; i < files.length; i++ ) | ||||
| { | { | ||||
| File f = new File( thisBaseDir, files[ i ] ); | File f = new File( thisBaseDir, files[ i ] ); | ||||
| @@ -643,8 +648,9 @@ public class Zip | |||||
| ZipOutputStream zOut, String prefix, String fullpath ) | ZipOutputStream zOut, String prefix, String fullpath ) | ||||
| throws IOException, TaskException | throws IOException, TaskException | ||||
| { | { | ||||
| if( prefix.length() > 0 && fullpath.length() > 0 ) | |||||
| if( prefix.length() > 0 && fullpath.length() > 0 ) { | |||||
| throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
| } | |||||
| ZipScanner zipScanner = (ZipScanner)ds; | ZipScanner zipScanner = (ZipScanner)ds; | ||||
| File zipSrc = fs.getSrc(); | File zipSrc = fs.getSrc(); | ||||
| @@ -83,8 +83,9 @@ public class Jikes | |||||
| Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
| cmd.setExecutable( "jikes" ); | cmd.setExecutable( "jikes" ); | ||||
| if( m_deprecation == true ) | |||||
| if( m_deprecation == true ) { | |||||
| cmd.addArgument( "-deprecation" ); | cmd.addArgument( "-deprecation" ); | ||||
| } | |||||
| if( m_destDir != null ) | if( m_destDir != null ) | ||||
| { | { | ||||
| @@ -313,10 +313,12 @@ public class ExecTask | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| if( m_ouput != null ) | |||||
| if( m_ouput != null ) { | |||||
| m_ouput.close(); | m_ouput.close(); | ||||
| if( m_byteArrayOutput != null ) | |||||
| } | |||||
| if( m_byteArrayOutput != null ) { | |||||
| m_byteArrayOutput.close(); | m_byteArrayOutput.close(); | ||||
| } | |||||
| } | } | ||||
| catch( IOException io ) | catch( IOException io ) | ||||
| { | { | ||||
| @@ -344,7 +346,9 @@ public class ExecTask | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| // default directory to the project's base directory | // default directory to the project's base directory | ||||
| if( m_workingDirectory == null ) m_workingDirectory = getBaseDirectory(); | |||||
| if( m_workingDirectory == null ) { | |||||
| m_workingDirectory = getBaseDirectory(); | |||||
| } | |||||
| // show the command | // show the command | ||||
| getLogger().debug( m_command.toString() ); | getLogger().debug( m_command.toString() ); | ||||
| @@ -50,8 +50,9 @@ public class Move | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| String[] list = d.list(); | String[] list = d.list(); | ||||
| if( list == null ) | |||||
| return;// on an io error list() can return null | |||||
| if( list == null ) { | |||||
| return; | |||||
| }// on an io error list() can return null | |||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| @@ -224,8 +225,9 @@ public class Move | |||||
| protected boolean okToDelete( File d ) | protected boolean okToDelete( File d ) | ||||
| { | { | ||||
| String[] list = d.list(); | String[] list = d.list(); | ||||
| if( list == null ) | |||||
| return false;// maybe io error? | |||||
| if( list == null ) { | |||||
| return false; | |||||
| }// maybe io error? | |||||
| for( int i = 0; i < list.length; i++ ) | for( int i = 0; i < list.length; i++ ) | ||||
| { | { | ||||
| @@ -233,8 +235,9 @@ public class Move | |||||
| File f = new File( d, s ); | File f = new File( d, s ); | ||||
| if( f.isDirectory() ) | if( f.isDirectory() ) | ||||
| { | { | ||||
| if( !okToDelete( f ) ) | |||||
| if( !okToDelete( f ) ) { | |||||
| return false; | return false; | ||||
| } | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -571,10 +571,12 @@ public class Javadoc | |||||
| cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
| cmd.addArgument( classpath.toString() ); | cmd.addArgument( classpath.toString() ); | ||||
| if( m_version && m_doclet == null ) | |||||
| if( m_version && m_doclet == null ) { | |||||
| cmd.addArgument( "-version" ); | cmd.addArgument( "-version" ); | ||||
| if( m_author && m_doclet == null ) | |||||
| } | |||||
| if( m_author && m_doclet == null ) { | |||||
| cmd.addArgument( "-author" ); | cmd.addArgument( "-author" ); | ||||
| } | |||||
| if( m_doclet == null ) | if( m_doclet == null ) | ||||
| { | { | ||||
| @@ -932,8 +934,9 @@ public class Javadoc | |||||
| ArrayList addedPackages = new ArrayList(); | ArrayList addedPackages = new ArrayList(); | ||||
| String[] list = sourcePath.list(); | String[] list = sourcePath.list(); | ||||
| if( list == null ) | |||||
| if( list == null ) { | |||||
| list = new String[ 0 ]; | list = new String[ 0 ]; | ||||
| } | |||||
| FileSet fs = new FileSet(); | FileSet fs = new FileSet(); | ||||
| fs.setDefaultexcludes( m_useDefaultExcludes ); | fs.setDefaultexcludes( m_useDefaultExcludes ); | ||||
| @@ -195,8 +195,9 @@ public class Cab | |||||
| { | { | ||||
| String file = files.get( i ).toString(); | String file = files.get( i ).toString(); | ||||
| if( new File( m_baseDir, file ).lastModified() > | if( new File( m_baseDir, file ).lastModified() > | ||||
| m_cabFile.lastModified() ) | |||||
| m_cabFile.lastModified() ) { | |||||
| upToDate = false; | upToDate = false; | ||||
| } | |||||
| } | } | ||||
| return upToDate; | return upToDate; | ||||
| } | } | ||||
| @@ -159,8 +159,9 @@ public class Entry | |||||
| GregorianCalendar value = new GregorianCalendar(); | GregorianCalendar value = new GregorianCalendar(); | ||||
| GregorianCalendar newValue = new GregorianCalendar(); | GregorianCalendar newValue = new GregorianCalendar(); | ||||
| if( m_pattern == null ) | |||||
| if( m_pattern == null ) { | |||||
| m_pattern = "yyyy/MM/dd HH:mm"; | m_pattern = "yyyy/MM/dd HH:mm"; | ||||
| } | |||||
| DateFormat fmt = new SimpleDateFormat( m_pattern ); | DateFormat fmt = new SimpleDateFormat( m_pattern ); | ||||
| // special case | // special case | ||||
| @@ -12,7 +12,7 @@ import java.util.ArrayList; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
| import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| @@ -89,8 +89,9 @@ public class ManifestFile extends Task | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| checkParameters(); | checkParameters(); | ||||
| if( isUpdate( currentMethod ) ) | |||||
| if( isUpdate( currentMethod ) ) { | |||||
| readFile(); | readFile(); | ||||
| } | |||||
| executeOperation(); | executeOperation(); | ||||
| writeFile(); | writeFile(); | ||||
| @@ -202,8 +203,9 @@ public class ManifestFile extends Task | |||||
| { | { | ||||
| stop = true; | stop = true; | ||||
| } | } | ||||
| else | |||||
| else { | |||||
| buffer.append( (char)c ); | buffer.append( (char)c ); | ||||
| } | |||||
| } | } | ||||
| fis.close(); | fis.close(); | ||||
| StringTokenizer lineTokens = getLineTokens( buffer ); | StringTokenizer lineTokens = getLineTokens( buffer ); | ||||
| @@ -315,8 +317,9 @@ public class ManifestFile extends Task | |||||
| Entry ent = new Entry(); | Entry ent = new Entry(); | ||||
| boolean result = false; | boolean result = false; | ||||
| int res = ent.compare( this, (Entry)obj ); | int res = ent.compare( this, (Entry)obj ); | ||||
| if( res == 0 ) | |||||
| if( res == 0 ) { | |||||
| result = true; | result = true; | ||||
| } | |||||
| return result; | return result; | ||||
| } | } | ||||
| @@ -169,8 +169,9 @@ public class NetRexxC extends MatchingTask | |||||
| public void setCompile( boolean compile ) | public void setCompile( boolean compile ) | ||||
| { | { | ||||
| this.compile = compile; | this.compile = compile; | ||||
| if( !this.compile && !this.keep ) | |||||
| if( !this.compile && !this.keep ) { | |||||
| this.keep = true; | this.keep = true; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -46,8 +46,9 @@ public class Script extends Task | |||||
| public void setSrc( String fileName ) | public void setSrc( String fileName ) | ||||
| { | { | ||||
| File file = new File( fileName ); | File file = new File( fileName ); | ||||
| if( !file.exists() ) | |||||
| if( !file.exists() ) { | |||||
| throw new TaskException( "file " + fileName + " not found." ); | throw new TaskException( "file " + fileName + " not found." ); | ||||
| } | |||||
| int count = (int)file.length(); | int count = (int)file.length(); | ||||
| byte data[] = new byte[ count ]; | byte data[] = new byte[ count ]; | ||||
| @@ -139,11 +140,13 @@ public class Script extends Task | |||||
| boolean isValid = key.length() > 0 && | boolean isValid = key.length() > 0 && | ||||
| Character.isJavaIdentifierStart( key.charAt( 0 ) ); | Character.isJavaIdentifierStart( key.charAt( 0 ) ); | ||||
| for( int i = 1; isValid && i < key.length(); i++ ) | |||||
| for( int i = 1; isValid && i < key.length(); i++ ) { | |||||
| isValid = Character.isJavaIdentifierPart( key.charAt( i ) ); | isValid = Character.isJavaIdentifierPart( key.charAt( i ) ); | ||||
| } | |||||
| if( isValid ) | |||||
| if( isValid ) { | |||||
| beans.put( key, dictionary.get( key ) ); | beans.put( key, dictionary.get( key ) ); | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -420,8 +420,9 @@ public class CSharp | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| //demand create pathlist | //demand create pathlist | ||||
| if( _referenceFiles == null ) | |||||
| if( _referenceFiles == null ) { | |||||
| _referenceFiles = new Path(); | _referenceFiles = new Path(); | ||||
| } | |||||
| _referenceFiles.append( path ); | _referenceFiles.append( path ); | ||||
| } | } | ||||
| @@ -461,8 +462,9 @@ public class CSharp | |||||
| { | { | ||||
| _targetType = targetType; | _targetType = targetType; | ||||
| } | } | ||||
| else | |||||
| else { | |||||
| throw new TaskException( "targetType " + targetType + " is not a valid type" ); | throw new TaskException( "targetType " + targetType + " is not a valid type" ); | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -648,7 +650,9 @@ public class CSharp | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( _srcDir == null ) _srcDir = getBaseDirectory(); | |||||
| if( _srcDir == null ) { | |||||
| _srcDir = getBaseDirectory(); | |||||
| } | |||||
| NetCommand command = new NetCommand( this, "CSC", csc_exe_name ); | NetCommand command = new NetCommand( this, "CSC", csc_exe_name ); | ||||
| command.setFailOnError( getFailFailOnError() ); | command.setFailOnError( getFailFailOnError() ); | ||||
| @@ -706,10 +710,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getAdditionalModulesParameter() | protected String getAdditionalModulesParameter() | ||||
| { | { | ||||
| if( notEmpty( _additionalModules ) ) | |||||
| if( notEmpty( _additionalModules ) ) { | |||||
| return "/addmodule:" + _additionalModules; | return "/addmodule:" + _additionalModules; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -735,8 +740,9 @@ public class CSharp | |||||
| s.append( DEFAULT_REFERENCE_LIST ); | s.append( DEFAULT_REFERENCE_LIST ); | ||||
| return new String( s ); | return new String( s ); | ||||
| } | } | ||||
| else | |||||
| else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -746,10 +752,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getDefinitionsParameter() | protected String getDefinitionsParameter() | ||||
| { | { | ||||
| if( notEmpty( _definitions ) ) | |||||
| if( notEmpty( _definitions ) ) { | |||||
| return "/define:" + _definitions; | return "/define:" + _definitions; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -759,10 +766,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getDocFileParameter() | protected String getDocFileParameter() | ||||
| { | { | ||||
| if( _docFile != null ) | |||||
| if( _docFile != null ) { | |||||
| return "/doc:" + _docFile.toString(); | return "/doc:" + _docFile.toString(); | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -772,10 +780,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getExtraOptionsParameter() | protected String getExtraOptionsParameter() | ||||
| { | { | ||||
| if( _extraOptions != null && _extraOptions.length() != 0 ) | |||||
| if( _extraOptions != null && _extraOptions.length() != 0 ) { | |||||
| return _extraOptions; | return _extraOptions; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| protected String getFullPathsParameter() | protected String getFullPathsParameter() | ||||
| @@ -810,10 +819,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getMainClassParameter() | protected String getMainClassParameter() | ||||
| { | { | ||||
| if( _mainClass != null && _mainClass.length() != 0 ) | |||||
| if( _mainClass != null && _mainClass.length() != 0 ) { | |||||
| return "/main:" + _mainClass; | return "/main:" + _mainClass; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| protected String getNoConfigParameter() | protected String getNoConfigParameter() | ||||
| @@ -843,8 +853,9 @@ public class CSharp | |||||
| File f = _outputFile; | File f = _outputFile; | ||||
| return "/out:" + f.toString(); | return "/out:" + f.toString(); | ||||
| } | } | ||||
| else | |||||
| else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -855,16 +866,18 @@ public class CSharp | |||||
| protected String getReferenceFilesParameter() | protected String getReferenceFilesParameter() | ||||
| { | { | ||||
| //bail on no references | //bail on no references | ||||
| if( _references == null ) | |||||
| if( _references == null ) { | |||||
| return null; | return null; | ||||
| } | |||||
| //iterate through the ref list & generate an entry for each | //iterate through the ref list & generate an entry for each | ||||
| //or just rely on the fact that the toString operator does this, but | //or just rely on the fact that the toString operator does this, but | ||||
| //noting that the separator is ';' on windows, ':' on unix | //noting that the separator is ';' on windows, ':' on unix | ||||
| String refpath = _references.toString(); | String refpath = _references.toString(); | ||||
| //bail on no references listed | //bail on no references listed | ||||
| if( refpath.length() == 0 ) | |||||
| if( refpath.length() == 0 ) { | |||||
| return null; | return null; | ||||
| } | |||||
| StringBuffer s = new StringBuffer( "/reference:" ); | StringBuffer s = new StringBuffer( "/reference:" ); | ||||
| s.append( refpath ); | s.append( refpath ); | ||||
| @@ -879,10 +892,11 @@ public class CSharp | |||||
| protected String getReferencesParameter() | protected String getReferencesParameter() | ||||
| { | { | ||||
| //bail on no references | //bail on no references | ||||
| if( notEmpty( _references ) ) | |||||
| if( notEmpty( _references ) ) { | |||||
| return "/reference:" + _references; | return "/reference:" + _references; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -892,10 +906,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getTargetTypeParameter() | protected String getTargetTypeParameter() | ||||
| { | { | ||||
| if( notEmpty( _targetType ) ) | |||||
| if( notEmpty( _targetType ) ) { | |||||
| return "/target:" + _targetType; | return "/target:" + _targetType; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -930,10 +945,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getWin32IconParameter() | protected String getWin32IconParameter() | ||||
| { | { | ||||
| if( _win32icon != null ) | |||||
| if( _win32icon != null ) { | |||||
| return "/win32icon:" + _win32icon.toString(); | return "/win32icon:" + _win32icon.toString(); | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -943,10 +959,11 @@ public class CSharp | |||||
| */ | */ | ||||
| protected String getWin32ResParameter() | protected String getWin32ResParameter() | ||||
| { | { | ||||
| if( _win32res != null ) | |||||
| if( _win32res != null ) { | |||||
| return "/win32res:" + _win32res.toString(); | return "/win32res:" + _win32res.toString(); | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -226,8 +226,9 @@ public class Ilasm | |||||
| { | { | ||||
| _targetType = targetType; | _targetType = targetType; | ||||
| } | } | ||||
| else | |||||
| else { | |||||
| throw new TaskException( "targetType " + targetType + " is not a valid type" ); | throw new TaskException( "targetType " + targetType + " is not a valid type" ); | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -305,7 +306,9 @@ public class Ilasm | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( _srcDir == null ) _srcDir = getBaseDirectory(); | |||||
| if( _srcDir == null ) { | |||||
| _srcDir = getBaseDirectory(); | |||||
| } | |||||
| //get dependencies list. | //get dependencies list. | ||||
| DirectoryScanner scanner = super.getDirectoryScanner( _srcDir ); | DirectoryScanner scanner = super.getDirectoryScanner( _srcDir ); | ||||
| @@ -372,10 +375,11 @@ public class Ilasm | |||||
| */ | */ | ||||
| protected String getExtraOptionsParameter() | protected String getExtraOptionsParameter() | ||||
| { | { | ||||
| if( _extraOptions != null && _extraOptions.length() != 0 ) | |||||
| if( _extraOptions != null && _extraOptions.length() != 0 ) { | |||||
| return _extraOptions; | return _extraOptions; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -385,10 +389,11 @@ public class Ilasm | |||||
| */ | */ | ||||
| protected String getKeyfileParameter() | protected String getKeyfileParameter() | ||||
| { | { | ||||
| if( _keyfile != null ) | |||||
| if( _keyfile != null ) { | |||||
| return "/keyfile:" + _keyfile.toString(); | return "/keyfile:" + _keyfile.toString(); | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -408,8 +413,9 @@ public class Ilasm | |||||
| */ | */ | ||||
| protected String getOutputFileParameter() | protected String getOutputFileParameter() | ||||
| { | { | ||||
| if( _outputFile == null || _outputFile.length() == 0 ) | |||||
| if( _outputFile == null || _outputFile.length() == 0 ) { | |||||
| return null; | return null; | ||||
| } | |||||
| File f = _outputFile; | File f = _outputFile; | ||||
| return "/output=" + f.toString(); | return "/output=" + f.toString(); | ||||
| } | } | ||||
| @@ -434,14 +440,16 @@ public class Ilasm | |||||
| protected String getTargetTypeParameter() | protected String getTargetTypeParameter() | ||||
| { | { | ||||
| if( !notEmpty( _targetType ) ) | |||||
| if( !notEmpty( _targetType ) ) { | |||||
| return null; | return null; | ||||
| if( _targetType.equals( "exe" ) ) | |||||
| } | |||||
| if( _targetType.equals( "exe" ) ) { | |||||
| return "/exe"; | return "/exe"; | ||||
| else if( _targetType.equals( "library" ) ) | |||||
| } else if( _targetType.equals( "library" ) ) { | |||||
| return "/dll"; | return "/dll"; | ||||
| else | |||||
| } else { | |||||
| return null; | return null; | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -26,8 +26,9 @@ import java.util.jar.Manifest; | |||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||
| import javax.xml.parsers.SAXParser; | import javax.xml.parsers.SAXParser; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.bcel.*; | |||||
| import org.apache.bcel.classfile.*; | |||||
| import org.apache.bcel.classfile.JavaClass; | |||||
| import org.apache.bcel.classfile.ClassParser; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| @@ -606,8 +607,9 @@ public class GenericDeploymentTool | |||||
| while( i.hasNext() ) | while( i.hasNext() ) | ||||
| { | { | ||||
| String entryName = (String)i.next(); | String entryName = (String)i.next(); | ||||
| if( entryName.endsWith( ".class" ) ) | |||||
| if( entryName.endsWith( ".class" ) ) { | |||||
| newSet.add( entryName.substring( 0, entryName.length() - ".class".length() ).replace( File.separatorChar, '/' ) ); | newSet.add( entryName.substring( 0, entryName.length() - ".class".length() ).replace( File.separatorChar, '/' ) ); | ||||
| } | |||||
| } | } | ||||
| set.addAll( newSet ); | set.addAll( newSet ); | ||||
| @@ -943,8 +943,9 @@ public class WebsphereDeploymentTool | |||||
| " " + tempdir + | " " + tempdir + | ||||
| " " + destJar.getPath() + | " " + destJar.getPath() + | ||||
| " " + getOptions(); | " " + getOptions(); | ||||
| if( getCombinedClasspath() != null && getCombinedClasspath().toString().length() > 0 ) | |||||
| if( getCombinedClasspath() != null && getCombinedClasspath().toString().length() > 0 ) { | |||||
| args += " -cp " + getCombinedClasspath(); | args += " -cp " + getCombinedClasspath(); | ||||
| } | |||||
| @@ -43,7 +43,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.BuildEvent; | import org.apache.tools.ant.BuildEvent; | ||||
| import org.apache.tools.ant.BuildListener; | import org.apache.tools.ant.BuildListener; | ||||
| import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
| import org.apache.tools.ant.util.StringUtils; | |||||
| /** | /** | ||||
| * This is a simple grafical user interface to provide the information needed by | * This is a simple grafical user interface to provide the information needed by | ||||
| @@ -1544,26 +1544,33 @@ public class VAJAntToolGUI extends Frame | |||||
| } | } | ||||
| } | } | ||||
| // MenuItems | // MenuItems | ||||
| if( e.getSource() == VAJAntToolGUI.this.getSaveMenuItem() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getSaveMenuItem() ) { | |||||
| saveBuildInfo(); | saveBuildInfo(); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutMenuItem() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutMenuItem() ) { | |||||
| getAboutDialog().show(); | getAboutDialog().show(); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getShowLogMenuItem() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getShowLogMenuItem() ) { | |||||
| getMessageFrame().show(); | getMessageFrame().show(); | ||||
| } | |||||
| /* | /* | ||||
| * #### About dialog #### | * #### About dialog #### | ||||
| */ | */ | ||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutOkButton() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutOkButton() ) { | |||||
| getAboutDialog().dispose(); | getAboutDialog().dispose(); | ||||
| } | |||||
| /* | /* | ||||
| * #### Log frame #### | * #### Log frame #### | ||||
| */ | */ | ||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOkButton() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOkButton() ) { | |||||
| getMessageFrame().dispose(); | getMessageFrame().dispose(); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageClearLogButton() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageClearLogButton() ) { | |||||
| getMessageTextArea().setText( "" ); | getMessageTextArea().setText( "" ); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOkButton() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOkButton() ) { | |||||
| getMessageFrame().dispose(); | getMessageFrame().dispose(); | ||||
| } | |||||
| } | } | ||||
| catch( Throwable exc ) | catch( Throwable exc ) | ||||
| { | { | ||||
| @@ -1580,12 +1587,15 @@ public class VAJAntToolGUI extends Frame | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| if( e.getSource() == VAJAntToolGUI.this.getTargetList() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getTargetList() ) { | |||||
| getBuildButton().setEnabled( true ); | getBuildButton().setEnabled( true ); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOutputLevelChoice() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageOutputLevelChoice() ) { | |||||
| getBuildInfo().setOutputMessageLevel( getMessageOutputLevelChoice().getSelectedIndex() ); | getBuildInfo().setOutputMessageLevel( getMessageOutputLevelChoice().getSelectedIndex() ); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getTargetList() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getTargetList() ) { | |||||
| getBuildInfo().setTarget( getTargetList().getSelectedItem() ); | getBuildInfo().setTarget( getTargetList().getSelectedItem() ); | ||||
| } | |||||
| } | } | ||||
| catch( Throwable exc ) | catch( Throwable exc ) | ||||
| { | { | ||||
| @@ -1600,10 +1610,12 @@ public class VAJAntToolGUI extends Frame | |||||
| */ | */ | ||||
| public void propertyChange( java.beans.PropertyChangeEvent evt ) | public void propertyChange( java.beans.PropertyChangeEvent evt ) | ||||
| { | { | ||||
| if( evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && ( evt.getPropertyName().equals( "projectName" ) ) ) | |||||
| if( evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && ( evt.getPropertyName().equals( "projectName" ) ) ) { | |||||
| connectProjectNameToLabel(); | connectProjectNameToLabel(); | ||||
| if( evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && ( evt.getPropertyName().equals( "buildFileName" ) ) ) | |||||
| } | |||||
| if( evt.getSource() == VAJAntToolGUI.this.getBuildInfo() && ( evt.getPropertyName().equals( "buildFileName" ) ) ) { | |||||
| connectBuildFileNameToTextField(); | connectBuildFileNameToTextField(); | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -1613,8 +1625,9 @@ public class VAJAntToolGUI extends Frame | |||||
| */ | */ | ||||
| public void textValueChanged( TextEvent e ) | public void textValueChanged( TextEvent e ) | ||||
| { | { | ||||
| if( e.getSource() == VAJAntToolGUI.this.getBuildFileTextField() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getBuildFileTextField() ) { | |||||
| connectTextFieldToBuildFileName(); | connectTextFieldToBuildFileName(); | ||||
| } | |||||
| } | } | ||||
| public void windowActivated( WindowEvent e ) | public void windowActivated( WindowEvent e ) | ||||
| @@ -1639,10 +1652,12 @@ public class VAJAntToolGUI extends Frame | |||||
| dispose(); | dispose(); | ||||
| System.exit( 0 ); | System.exit( 0 ); | ||||
| } | } | ||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutDialog() ) | |||||
| if( e.getSource() == VAJAntToolGUI.this.getAboutDialog() ) { | |||||
| getAboutDialog().dispose(); | getAboutDialog().dispose(); | ||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageFrame() ) | |||||
| } | |||||
| if( e.getSource() == VAJAntToolGUI.this.getMessageFrame() ) { | |||||
| getMessageFrame().dispose(); | getMessageFrame().dispose(); | ||||
| } | |||||
| } | } | ||||
| catch( Throwable exc ) | catch( Throwable exc ) | ||||
| { | { | ||||
| @@ -14,7 +14,7 @@ import java.util.Hashtable; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
| @@ -14,8 +14,8 @@ import java.util.Hashtable; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| import org.apache.tools.ant.types.Commandline; | |||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.PathUtil; | import org.apache.tools.ant.types.PathUtil; | ||||
| @@ -14,7 +14,7 @@ import java.io.PrintWriter; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
| @@ -232,8 +232,9 @@ public class JDependTask | |||||
| File f = new File( elements[ i ] ); | File f = new File( elements[ i ] ); | ||||
| // not necessary as JDepend would fail, but why loose some time? | // not necessary as JDepend would fail, but why loose some time? | ||||
| if( !f.exists() || !f.isDirectory() ) | |||||
| if( !f.exists() || !f.isDirectory() ) { | |||||
| throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); | throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); | ||||
| } | |||||
| commandline.addArgument( f.getPath() ); | commandline.addArgument( f.getPath() ); | ||||
| } | } | ||||
| @@ -101,10 +101,11 @@ public class JspC extends MatchingTask | |||||
| public void setClasspath( Path cp ) | public void setClasspath( Path cp ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( classpath == null ) | |||||
| if( classpath == null ) { | |||||
| classpath = cp; | classpath = cp; | ||||
| else | |||||
| } else { | |||||
| classpath.append( cp ); | classpath.append( cp ); | ||||
| } | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -298,8 +299,9 @@ public class JspC extends MatchingTask | |||||
| public Path createClasspath() | public Path createClasspath() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( classpath == null ) | |||||
| if( classpath == null ) { | |||||
| classpath = new Path(); | classpath = new Path(); | ||||
| } | |||||
| Path path1 = classpath; | Path path1 = classpath; | ||||
| final Path path = new Path(); | final Path path = new Path(); | ||||
| path1.addPath( path ); | path1.addPath( path ); | ||||
| @@ -332,9 +334,9 @@ public class JspC extends MatchingTask | |||||
| // calculate where the files will end up: | // calculate where the files will end up: | ||||
| File dest = null; | File dest = null; | ||||
| if( packageName == null ) | |||||
| if( packageName == null ) { | |||||
| dest = destDir; | dest = destDir; | ||||
| else | |||||
| } else | |||||
| { | { | ||||
| String path = destDir.getPath() + File.separatorChar + | String path = destDir.getPath() + File.separatorChar + | ||||
| packageName.replace( '.', File.separatorChar ); | packageName.replace( '.', File.separatorChar ); | ||||
| @@ -37,12 +37,14 @@ public class JasperC | |||||
| // the project log | // the project log | ||||
| //FIXME | //FIXME | ||||
| Java java = null;//(Java)( getJspc().getProject() ).createTask( "java" ); | Java java = null;//(Java)( getJspc().getProject() ).createTask( "java" ); | ||||
| if( getJspc().getClasspath() != null ) | |||||
| if( getJspc().getClasspath() != null ) { | |||||
| java.addClasspath( getJspc().getClasspath() ); | java.addClasspath( getJspc().getClasspath() ); | ||||
| } | |||||
| java.setClassname( "org.apache.jasper.JspC" ); | java.setClassname( "org.apache.jasper.JspC" ); | ||||
| String args[] = cmd.getArguments(); | String args[] = cmd.getArguments(); | ||||
| for( int i = 0; i < args.length; i++ ) | |||||
| for( int i = 0; i < args.length; i++ ) { | |||||
| java.addArg( new Argument( args[ i ] ) ); | java.addArg( new Argument( args[ i ] ) ); | ||||
| } | |||||
| java.execute(); | java.execute(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -13,7 +13,7 @@ import java.util.Arrays; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.types.DirectoryScanner; | import org.apache.tools.ant.types.DirectoryScanner; | ||||
| import org.apache.tools.ant.Project; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| /** | /** | ||||
| @@ -47,7 +47,7 @@ public final class BatchTest extends BaseTest | |||||
| * @param filename the filename to "convert" to a classname. | * @param filename the filename to "convert" to a classname. | ||||
| * @return the classname matching the filename. | * @return the classname matching the filename. | ||||
| */ | */ | ||||
| public final static String javaToClass( String filename ) | |||||
| public static final String javaToClass( String filename ) | |||||
| { | { | ||||
| return filename.replace( File.separatorChar, '.' ); | return filename.replace( File.separatorChar, '.' ); | ||||
| } | } | ||||
| @@ -97,7 +97,7 @@ public final class DOMUtil | |||||
| * <tt>parent</tt> . | * <tt>parent</tt> . | ||||
| * @return the cloned node that is appended to <tt>parent</tt> | * @return the cloned node that is appended to <tt>parent</tt> | ||||
| */ | */ | ||||
| public final static Node importNode( Node parent, Node child ) | |||||
| public static final Node importNode( Node parent, Node child ) | |||||
| { | { | ||||
| Node copy = null; | Node copy = null; | ||||
| final Document doc = parent.getOwnerDocument(); | final Document doc = parent.getOwnerDocument(); | ||||
| @@ -665,8 +665,9 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| if( !propsFile.delete() ) | |||||
| if( !propsFile.delete() ) { | |||||
| throw new TaskException( "Could not delete temporary properties file." ); | throw new TaskException( "Could not delete temporary properties file." ); | ||||
| } | |||||
| } | } | ||||
| return retVal; | return retVal; | ||||
| @@ -15,7 +15,7 @@ import java.text.NumberFormat; | |||||
| import java.util.Hashtable; | import java.util.Hashtable; | ||||
| import junit.framework.AssertionFailedError; | import junit.framework.AssertionFailedError; | ||||
| import junit.framework.Test; | import junit.framework.Test; | ||||
| import junit.framework.TestCase; | |||||
| import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||