diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java
index 5d8072ec9..bb1faff91 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatability.java
@@ -69,21 +69,19 @@ package org.apache.tools.ant.taskdefs.optional.extension;
* @version $Revision$ $Date$
* @see Extension
*/
-public final class Compatability
-{
+public final class Compatability {
/**
* A string representaiton of compatability level.
*/
- private final String m_name;
+ private final String name;
/**
* Create a compatability enum with specified name.
*
* @param name the name of compatability level
*/
- Compatability( final String name )
- {
- m_name = name;
+ Compatability(final String name) {
+ this.name = name;
}
/**
@@ -91,8 +89,7 @@ public final class Compatability
*
* @return the name of compatability level
*/
- public String toString()
- {
- return m_name;
+ public String toString() {
+ return name;
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java
index c1eb4beed..554af2ce1 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Compatibility.java
@@ -69,21 +69,19 @@ package org.apache.tools.ant.taskdefs.optional.extension;
* @version $Revision$ $Date$
* @see Extension
*/
-public final class Compatibility
-{
+public final class Compatibility {
/**
* A string representaiton of compatibility level.
*/
- private final String m_name;
+ private final String name;
/**
* Create a compatibility enum with specified name.
*
* @param name the name of compatibility level
*/
- Compatibility( final String name )
- {
- m_name = name;
+ Compatibility(final String name) {
+ this.name = name;
}
/**
@@ -91,8 +89,7 @@ public final class Compatibility
*
* @return the name of compatibility level
*/
- public String toString()
- {
- return m_name;
+ public String toString() {
+ return name;
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java
index ea89fd465..e9abff48a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/DeweyDecimal.java
@@ -63,33 +63,23 @@ import java.util.StringTokenizer;
* represent major, minor, micro, etc versions. The version number
* must begin with a number.
*
- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- * This file is from excalibur.extension package. Dont edit this file
- * directly as there is no unit tests to make sure it is operational
- * in ant. Edit file in excalibur and run tests there before changing
- * ants file.
- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- *
* @author Peter Donald
* @version $Revision$ $Date$
*/
-public final class DeweyDecimal
-{
- ///Array of components that make up DeweyDecimal
- private int[] m_components;
+public final class DeweyDecimal {
+ /** Array of components that make up DeweyDecimal */
+ private int[] components;
/**
* Construct a DeweyDecimal from an array of integer components.
*
* @param components an array of integer components.
*/
- public DeweyDecimal( final int[] components )
- {
- m_components = new int[ components.length ];
+ public DeweyDecimal(final int[] components) {
+ this.components = new int[components.length];
- for( int i = 0; i < m_components.length; i++ )
- {
- m_components[ i ] = components[ i ];
+ for (int i = 0; i < components.length; i++) {
+ this.components[i] = components[i];
}
}
@@ -99,33 +89,28 @@ public final class DeweyDecimal
* @param string the string in dewey decimal format
* @exception NumberFormatException if string is malformed
*/
- public DeweyDecimal( final String string )
- throws NumberFormatException
- {
- final StringTokenizer tokenizer = new StringTokenizer( string, ".", true );
+ public DeweyDecimal(final String string)
+ throws NumberFormatException {
+ final StringTokenizer tokenizer = new StringTokenizer(string, ".", true);
final int size = tokenizer.countTokens();
- m_components = new int[ ( size + 1 ) / 2 ];
+ components = new int[ (size + 1) / 2 ];
- for( int i = 0; i < m_components.length; i++ )
- {
+ for (int i = 0; i < components.length; i++) {
final String component = tokenizer.nextToken();
- if( component.equals( "" ) )
- {
- throw new NumberFormatException( "Empty component in string" );
+ if (component.equals("")) {
+ throw new NumberFormatException("Empty component in string");
}
- m_components[ i ] = Integer.parseInt( component );
+ components[ i ] = Integer.parseInt(component);
//Strip '.' token
- if( tokenizer.hasMoreTokens() )
- {
+ if (tokenizer.hasMoreTokens()) {
tokenizer.nextToken();
//If it ended in a dot, throw an exception
- if( !tokenizer.hasMoreTokens() )
- {
- throw new NumberFormatException( "DeweyDecimal ended in a '.'" );
+ if (!tokenizer.hasMoreTokens()) {
+ throw new NumberFormatException("DeweyDecimal ended in a '.'");
}
}
}
@@ -136,9 +121,8 @@ public final class DeweyDecimal
*
* @return the number of components in dewey decimal
*/
- public int getSize()
- {
- return m_components.length;
+ public int getSize() {
+ return components.length;
}
/**
@@ -147,9 +131,8 @@ public final class DeweyDecimal
* @param index the index of components
* @return the value of component at index
*/
- public int get( final int index )
- {
- return m_components[ index ];
+ public int get(final int index) {
+ return components[ index ];
}
/**
@@ -159,17 +142,14 @@ public final class DeweyDecimal
* @param other the other DeweyDecimal
* @return true if equal to other DeweyDecimal, false otherwise
*/
- public boolean isEqual( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length, m_components.length );
+ public boolean isEqual(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ? m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ? other.m_components[ i ] : 0;
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ] : 0;
+ final int component2 = (i < other.components.length) ? other.components[ i ] : 0;
- if( component2 != component1 )
- {
+ if (component2 != component1) {
return false;
}
}
@@ -184,9 +164,8 @@ public final class DeweyDecimal
* @param other the other DeweyDecimal
* @return true if less than other DeweyDecimal, false otherwise
*/
- public boolean isLessThan( final DeweyDecimal other )
- {
- return !isGreaterThanOrEqual( other );
+ public boolean isLessThan(final DeweyDecimal other) {
+ return !isGreaterThanOrEqual(other);
}
/**
@@ -196,9 +175,8 @@ public final class DeweyDecimal
* @param other the other DeweyDecimal
* @return true if less than or equal to other DeweyDecimal, false otherwise
*/
- public boolean isLessThanOrEqual( final DeweyDecimal other )
- {
- return !isGreaterThan( other );
+ public boolean isLessThanOrEqual(final DeweyDecimal other) {
+ return !isGreaterThan(other);
}
/**
@@ -208,21 +186,17 @@ public final class DeweyDecimal
* @param other the other DeweyDecimal
* @return true if greater than other DeweyDecimal, false otherwise
*/
- public boolean isGreaterThan( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length, m_components.length );
+ public boolean isGreaterThan(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ? m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ? other.m_components[ i ] : 0;
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ] : 0;
+ final int component2 = (i < other.components.length) ? other.components[ i ] : 0;
- if( component2 > component1 )
- {
+ if (component2 > component1) {
return false;
}
- if( component2 < component1 )
- {
+ if (component2 < component1) {
return true;
}
}
@@ -237,21 +211,17 @@ public final class DeweyDecimal
* @param other the other DeweyDecimal
* @return true if greater than or equal to other DeweyDecimal, false otherwise
*/
- public boolean isGreaterThanOrEqual( final DeweyDecimal other )
- {
- final int max = Math.max( other.m_components.length, m_components.length );
+ public boolean isGreaterThanOrEqual(final DeweyDecimal other) {
+ final int max = Math.max(other.components.length, components.length);
- for( int i = 0; i < max; i++ )
- {
- final int component1 = ( i < m_components.length ) ? m_components[ i ] : 0;
- final int component2 = ( i < other.m_components.length ) ? other.m_components[ i ] : 0;
+ for (int i = 0; i < max; i++) {
+ final int component1 = (i < components.length) ? components[ i ] : 0;
+ final int component2 = (i < other.components.length) ? other.components[ i ] : 0;
- if( component2 > component1 )
- {
+ if (component2 > component1) {
return false;
}
- if( component2 < component1 )
- {
+ if (component2 < component1) {
return true;
}
}
@@ -264,17 +234,14 @@ public final class DeweyDecimal
*
* @return the string representation of DeweyDecimal.
*/
- public String toString()
- {
+ public String toString() {
final StringBuffer sb = new StringBuffer();
- for( int i = 0; i < m_components.length; i++ )
- {
- if( i != 0 )
- {
- sb.append( '.' );
+ for (int i = 0; i < components.length; i++) {
+ if (i != 0) {
+ sb.append('.');
}
- sb.append( m_components[ i ] );
+ sb.append(components[ i ]);
}
return sb.toString();
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
index 4224d377f..d3f4dbe0f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionAdapter.java
@@ -65,59 +65,56 @@ import org.apache.tools.ant.types.Reference;
* @version $Revision$ $Date$
* @ant.data-type name="extension"
*/
-public class ExtensionAdapter
- extends DataType
-{
+public class ExtensionAdapter extends DataType {
/**
* The name of the optional package being made available, or required.
*/
- private String m_extensionName;
+ private String extensionName;
/**
* The version number (dotted decimal notation) of the specification
* to which this optional package conforms.
*/
- private DeweyDecimal m_specificationVersion;
+ private DeweyDecimal specificationVersion;
/**
* The name of the company or organization that originated the
* specification to which this optional package conforms.
*/
- private String m_specificationVendor;
+ private String specificationVendor;
/**
* The unique identifier of the company that produced the optional
* package contained in this JAR file.
*/
- private String m_implementationVendorID;
+ private String implementationVendorID;
/**
* The name of the company or organization that produced this
* implementation of this optional package.
*/
- private String m_implementationVendor;
+ private String implementationVendor;
/**
* The version number (dotted decimal notation) for this implementation
* of the optional package.
*/
- private DeweyDecimal m_implementationVersion;
+ private DeweyDecimal implementationVersion;
/**
* The URL from which the most recent version of this optional package
* can be obtained if it is not already installed.
*/
- private String m_implementationURL;
+ private String implementationVendor;
/**
* Set the name of extension.
*
* @param extensionName the name of extension
*/
- public void setExtensionName( final String extensionName )
- {
+ public void setExtensionName(final String extensionName) {
verifyNotAReference();
- m_extensionName = extensionName;
+ this.extensionName = extensionName;
}
/**
@@ -125,10 +122,9 @@ public class ExtensionAdapter
*
* @param specificationVersion the specificationVersion of extension
*/
- public void setSpecificationVersion( final String specificationVersion )
- {
+ public void setSpecificationVersion(final String specificationVersion) {
verifyNotAReference();
- m_specificationVersion = new DeweyDecimal( specificationVersion );
+ this.specificationVersion = new DeweyDecimal(specificationVersion);
}
/**
@@ -136,10 +132,9 @@ public class ExtensionAdapter
*
* @param specificationVendor the specificationVendor of extension
*/
- public void setSpecificationVendor( final String specificationVendor )
- {
+ public void setSpecificationVendor(final String specificationVendor) {
verifyNotAReference();
- m_specificationVendor = specificationVendor;
+ this.specificationVendor = specificationVendor;
}
/**
@@ -147,10 +142,9 @@ public class ExtensionAdapter
*
* @param implementationVendorID the implementationVendorID of extension
*/
- public void setImplementationVendorId( final String implementationVendorID )
- {
+ public void setImplementationVendorId(final String implementationVendorID) {
verifyNotAReference();
- m_implementationVendorID = implementationVendorID;
+ this.implementationVendorID = implementationVendorID;
}
/**
@@ -158,10 +152,9 @@ public class ExtensionAdapter
*
* @param implementationVendor the implementationVendor of extension
*/
- public void setImplementationVendor( final String implementationVendor )
- {
+ public void setImplementationVendor(final String implementationVendor) {
verifyNotAReference();
- m_implementationVendor = implementationVendor;
+ this.implementationVendor = implementationVendor;
}
/**
@@ -169,10 +162,9 @@ public class ExtensionAdapter
*
* @param implementationVersion the implementationVersion of extension
*/
- public void setImplementationVersion( final String implementationVersion )
- {
+ public void setImplementationVersion(final String implementationVersion) {
verifyNotAReference();
- m_implementationVersion = new DeweyDecimal( implementationVersion );
+ this.implementationVersion = new DeweyDecimal(implementationVersion);
}
/**
@@ -180,10 +172,9 @@ public class ExtensionAdapter
*
* @param implementationURL the implementationURL of extension
*/
- public void setImplementationUrl( final String implementationURL )
- {
+ public void setImplementationUrl(final String implementationURL) {
verifyNotAReference();
- m_implementationURL = implementationURL;
+ this.implementationVendor = implementationURL;
}
/**
@@ -196,47 +187,40 @@ public class ExtensionAdapter
* @param reference the reference to which this instance is associated
* @exception BuildException if this instance already has been configured.
*/
- public void setRefid( final Reference reference )
- throws BuildException
- {
- if( null != m_extensionName ||
- null != m_specificationVersion ||
- null != m_specificationVendor ||
- null != m_implementationVersion ||
- null != m_implementationVendorID ||
- null != m_implementationVendor ||
- null != m_implementationURL )
- {
+ public void setRefid(final Reference reference)
+ throws BuildException {
+ if (null != extensionName
+ || null != specificationVersion
+ || null != specificationVendor
+ || null != implementationVersion
+ || null != implementationVendorID
+ || null != implementationVendor
+ || null != implementationVendor) {
throw tooManyAttributes();
}
// change this to get the objects from the other reference
- Object o = reference.getReferencedObject( getProject() );
- if( o instanceof ExtensionAdapter )
- {
- final ExtensionAdapter other = (ExtensionAdapter)o;
- m_extensionName = other.m_extensionName;
- m_specificationVersion = other.m_specificationVersion;
- m_specificationVendor = other.m_specificationVendor;
- m_implementationVersion = other.m_implementationVersion;
- m_implementationVendorID = other.m_implementationVendorID;
- m_implementationVendor = other.m_implementationVendor;
- m_implementationURL = other.m_implementationURL;
- }
- else
- {
+ Object o = reference.getReferencedObject(getProject());
+ if (o instanceof ExtensionAdapter) {
+ final ExtensionAdapter other = (ExtensionAdapter) o;
+ extensionName = other.extensionName;
+ specificationVersion = other.specificationVersion;
+ specificationVendor = other.specificationVendor;
+ implementationVersion = other.implementationVersion;
+ implementationVendorID = other.implementationVendorID;
+ implementationVendor = other.implementationVendor;
+ implementationVendor = other.implementationVendor;
+ } else {
final String message =
reference.getRefId() + " doesn\'t refer to a Extension";
- throw new BuildException( message );
+ throw new BuildException(message);
}
- super.setRefid( reference );
+ super.setRefid(reference);
}
private void verifyNotAReference()
- throws BuildException
- {
- if( isReference() )
- {
+ throws BuildException {
+ if (isReference()) {
throw tooManyAttributes();
}
}
@@ -247,35 +231,33 @@ public class ExtensionAdapter
* @return the extension object
*/
Extension toExtension()
- throws BuildException
- {
- if( null == m_extensionName )
- {
+ throws BuildException {
+ if (null == extensionName) {
final String message = "Extension is missing name.";
- throw new BuildException( message );
+ throw new BuildException(message);
}
- String specificationVersion = null;
- if( null != m_specificationVersion )
- {
- specificationVersion = m_specificationVersion.toString();
+ String specificationVersionString = null;
+ if (null != specificationVersion) {
+ specificationVersionString = specificationVersion.toString();
}
- String implementationVersion = null;
- if( null != m_implementationVersion )
- {
- implementationVersion = m_implementationVersion.toString();
+ String implementationVersionString = null;
+ if (null != implementationVersion) {
+ implementationVersionString = implementationVersion.toString();
}
- return new Extension( m_extensionName,
- specificationVersion,
- m_specificationVendor,
- implementationVersion,
- m_implementationVendor,
- m_implementationVendorID,
- m_implementationURL );
+ return new Extension(extensionName,
+ specificationVersionString,
+ specificationVendor,
+ implementationVersionString,
+ implementationVendor,
+ implementationVendorID,
+ implementationVendor);
}
- public String toString()
- {
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
return "{" + toExtension().toString() + "}";
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java
index 84e865c1a..2b772b6e3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionResolver.java
@@ -64,18 +64,18 @@ import org.apache.tools.ant.Project;
* @author Jeff Turner>
* @version $Revision$ $Date$
*/
-public interface ExtensionResolver
-{
+public interface ExtensionResolver {
/**
* Attempt to locate File that satisfies
* extension via resolver.
*
* @param extension the extension
+ * @param project the Ant project instance
* @return the File satisfying extension, null
* if can not resolve extension
* @throws BuildException if error occurs attempting to
* resolve extension
*/
- File resolve( Extension extension, Project project )
+ File resolve(Extension extension, Project project)
throws BuildException;
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java
index 6c1267722..ef8d7f76f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionSet.java
@@ -70,26 +70,24 @@ import org.apache.tools.ant.types.Reference;
* @ant.data-type name="extension-set"
*/
public class ExtensionSet
- extends DataType
-{
+ extends DataType {
/**
* ExtensionAdapter objects representing extensions.
*/
- private final ArrayList m_extensions = new ArrayList();
+ private final ArrayList extensions = new ArrayList();
/**
* Filesets specifying all the extensions wanted.
*/
- private final ArrayList m_extensionsFilesets = new ArrayList();
+ private final ArrayList extensionsFilesets = new ArrayList();
/**
* Adds an extension that this library requires.
*
* @param extensionAdapter an extension that this library requires.
*/
- public void addExtension( final ExtensionAdapter extensionAdapter )
- {
- m_extensions.add( extensionAdapter );
+ public void addExtension(final ExtensionAdapter extensionAdapter) {
+ extensions.add(extensionAdapter);
}
/**
@@ -97,9 +95,8 @@ public class ExtensionSet
*
* @param fileSet a set of files about which extensions data will be extracted.
*/
- public void addLibfileset( final LibFileSet fileSet )
- {
- m_extensionsFilesets.add( fileSet );
+ public void addLibfileset(final LibFileSet fileSet) {
+ extensionsFilesets.add(fileSet);
}
/**
@@ -107,22 +104,22 @@ public class ExtensionSet
*
* @param fileSet a set of files about which extensions data will be extracted.
*/
- public void addFileset( final FileSet fileSet )
- {
- m_extensionsFilesets.add( fileSet );
+ public void addFileset(final FileSet fileSet) {
+ extensionsFilesets.add(fileSet);
}
/**
* Extract a set of Extension objects from the ExtensionSet.
*
+ * @param project the project instance.
+ * @return an array containing the Extensions from this set
* @throws BuildException if an error occurs
*/
- public Extension[] toExtensions( final Project project )
- throws BuildException
- {
- final ArrayList extensions = ExtensionUtil.toExtensions( m_extensions );
- ExtensionUtil.extractExtensions( project, extensions, m_extensionsFilesets );
- return (Extension[])extensions.toArray( new Extension[ extensions.size() ] );
+ public Extension[] toExtensions(final Project project)
+ throws BuildException {
+ final ArrayList extensionsList = ExtensionUtil.toExtensions(extensions);
+ ExtensionUtil.extractExtensions(project, extensionsList, extensionsFilesets);
+ return (Extension[]) extensionsList.toArray(new Extension[extensionsList.size()]);
}
/**
@@ -135,35 +132,31 @@ public class ExtensionSet
* @param reference the reference to which this instance is associated
* @exception BuildException if this instance already has been configured.
*/
- public void setRefid( final Reference reference )
- throws BuildException
- {
- if( !m_extensions.isEmpty() ||
- !m_extensionsFilesets.isEmpty() )
- {
+ public void setRefid(final Reference reference)
+ throws BuildException {
+ if (!extensions.isEmpty() || !extensionsFilesets.isEmpty()) {
throw tooManyAttributes();
}
// change this to get the objects from the other reference
final Object object =
- reference.getReferencedObject( getProject() );
- if( object instanceof ExtensionSet )
- {
- final ExtensionSet other = (ExtensionSet)object;
- m_extensions.addAll( other.m_extensions );
- m_extensionsFilesets.addAll( other.m_extensionsFilesets );
- }
- else
- {
+ reference.getReferencedObject(getProject());
+ if (object instanceof ExtensionSet) {
+ final ExtensionSet other = (ExtensionSet) object;
+ extensions.addAll(other.extensions);
+ extensionsFilesets.addAll(other.extensionsFilesets);
+ } else {
final String message =
reference.getRefId() + " doesn\'t refer to a ExtensionSet";
- throw new BuildException( message );
+ throw new BuildException(message);
}
- super.setRefid( reference );
+ super.setRefid(reference);
}
- public String toString()
- {
- return "ExtensionSet" + Arrays.asList( toExtensions( getProject() ) );
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "ExtensionSet" + Arrays.asList(toExtensions(getProject()));
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
index e948fb308..d6cb01c5a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
@@ -70,26 +70,29 @@ import org.apache.tools.ant.types.FileSet;
* @author Peter Donald
* @version $Revision$ $Date$
*/
-public class ExtensionUtil
-{
+public class ExtensionUtil {
+ /**
+ * Class is not meant to be instantiated.
+ */
+ private ExtensionUtil() {
+ }
+
/**
* Convert a list of extensionAdapter objects to extensions.
*
* @param adapters the list of ExtensionAdapterss to add to convert
* @throws BuildException if an error occurs
*/
- static ArrayList toExtensions( final ArrayList adapters )
- throws BuildException
- {
+ static ArrayList toExtensions(final ArrayList adapters)
+ throws BuildException {
final ArrayList results = new ArrayList();
final int size = adapters.size();
- for( int i = 0; i < size; i++ )
- {
+ for (int i = 0; i < size; i++) {
final ExtensionAdapter adapter =
- (ExtensionAdapter)adapters.get( i );
+ (ExtensionAdapter) adapters.get(i);
final Extension extension = adapter.toExtension();
- results.add( extension );
+ results.add(extension);
}
return results;
@@ -102,18 +105,15 @@ public class ExtensionUtil
* @param fileset the filesets containing librarys
* @throws BuildException if an error occurs
*/
- static void extractExtensions( final Project project,
+ static void extractExtensions(final Project project,
final ArrayList librarys,
- final ArrayList fileset )
- throws BuildException
- {
- if( !fileset.isEmpty() )
- {
- final Extension[] extensions = getExtensions( project,
- fileset );
- for( int i = 0; i < extensions.length; i++ )
- {
- librarys.add( extensions[ i ] );
+ final ArrayList fileset)
+ throws BuildException {
+ if (!fileset.isEmpty()) {
+ final Extension[] extensions = getExtensions(project,
+ fileset);
+ for (int i = 0; i < extensions.length; i++) {
+ librarys.add(extensions[ i ]);
}
}
}
@@ -125,36 +125,32 @@ public class ExtensionUtil
* @return the extensions contained in librarys
* @throws BuildException if failing to scan librarys
*/
- private static Extension[] getExtensions( final Project project,
- final ArrayList librarys )
- throws BuildException
- {
+ private static Extension[] getExtensions(final Project project,
+ final ArrayList librarys)
+ throws BuildException {
final ArrayList extensions = new ArrayList();
final Iterator iterator = librarys.iterator();
- while( iterator.hasNext() )
- {
- final FileSet fileSet = (FileSet)iterator.next();
+ while (iterator.hasNext()) {
+ final FileSet fileSet = (FileSet) iterator.next();
boolean includeImpl = true;
boolean includeURL = true;
- if( fileSet instanceof LibFileSet )
- {
- LibFileSet libFileSet = (LibFileSet)fileSet;
+ if (fileSet instanceof LibFileSet) {
+ LibFileSet libFileSet = (LibFileSet) fileSet;
includeImpl = libFileSet.isIncludeImpl();
includeURL = libFileSet.isIncludeURL();
}
- final DirectoryScanner scanner = fileSet.getDirectoryScanner( project );
+ final DirectoryScanner scanner = fileSet.getDirectoryScanner(project);
final File basedir = scanner.getBasedir();
final String[] files = scanner.getIncludedFiles();
- for( int i = 0; i < files.length; i++ )
- {
- final File file = new File( basedir, files[ i ] );
- loadExtensions( file, extensions, includeImpl, includeURL );
+ for (int i = 0; i < files.length; i++) {
+ final File file = new File(basedir, files[ i ]);
+ loadExtensions(file, extensions, includeImpl, includeURL);
}
}
- return (Extension[])extensions.toArray( new Extension[ extensions.size() ] );
+ return (Extension[]) extensions.toArray(new Extension[extensions.size()]);
}
/**
@@ -164,26 +160,21 @@ public class ExtensionUtil
* @param extensionList the list to add available extensions to
* @throws BuildException if there is an error
*/
- private static void loadExtensions( final File file,
+ private static void loadExtensions(final File file,
final ArrayList extensionList,
final boolean includeImpl,
- final boolean includeURL )
- throws BuildException
- {
- try
- {
- final JarFile jarFile = new JarFile( file );
+ final boolean includeURL)
+ throws BuildException {
+ try {
+ final JarFile jarFile = new JarFile(file);
final Extension[] extensions =
- Extension.getAvailable( jarFile.getManifest() );
- for( int i = 0; i < extensions.length; i++ )
- {
+ Extension.getAvailable(jarFile.getManifest());
+ for (int i = 0; i < extensions.length; i++) {
final Extension extension = extensions[ i ];
- addExtension( extensionList, extension, includeImpl, includeURL );
+ addExtension(extensionList, extension, includeImpl, includeURL);
}
- }
- catch( final Exception e )
- {
- throw new BuildException( e.getMessage(), e );
+ } catch (final Exception e) {
+ throw new BuildException(e.getMessage(), e);
}
}
@@ -198,44 +189,41 @@ public class ExtensionUtil
* @param includeImpl false to exclude implementation details
* @param includeURL false to exclude implementation URL
*/
- private static void addExtension( final ArrayList extensionList,
+ private static void addExtension(final ArrayList extensionList,
final Extension originalExtension,
final boolean includeImpl,
- final boolean includeURL )
- {
+ final boolean includeURL) {
Extension extension = originalExtension;
- if( !includeURL &&
- null != extension.getImplementationURL() )
- {
+ if (!includeURL
+ && null != extension.getImplementationURL()) {
extension =
- new Extension( extension.getExtensionName(),
+ new Extension(extension.getExtensionName(),
extension.getSpecificationVersion().toString(),
extension.getSpecificationVendor(),
extension.getImplementationVersion().toString(),
extension.getImplementationVendor(),
extension.getImplementationVendorID(),
- null );
+ null);
}
final boolean hasImplAttributes =
- null != extension.getImplementationURL() ||
- null != extension.getImplementationVersion() ||
- null != extension.getImplementationVendorID() ||
- null != extension.getImplementationVendor();
+ null != extension.getImplementationURL()
+ || null != extension.getImplementationVersion()
+ || null != extension.getImplementationVendorID()
+ || null != extension.getImplementationVendor();
- if( !includeImpl && hasImplAttributes )
- {
+ if (!includeImpl && hasImplAttributes) {
extension =
- new Extension( extension.getExtensionName(),
+ new Extension(extension.getExtensionName(),
extension.getSpecificationVersion().toString(),
extension.getSpecificationVendor(),
null,
null,
null,
- extension.getImplementationURL() );
+ extension.getImplementationURL());
}
- extensionList.add( extension );
+ extensionList.add(extension);
}
/**
@@ -246,17 +234,13 @@ public class ExtensionUtil
* @throws BuildException if errror occurs (file not exist,
* file not a jar, manifest not exist in file)
*/
- static Manifest getManifest( final File file )
- throws BuildException
- {
- try
- {
- final JarFile jarFile = new JarFile( file );
+ static Manifest getManifest(final File file)
+ throws BuildException {
+ try {
+ final JarFile jarFile = new JarFile(file);
return jarFile.getManifest();
- }
- catch( final IOException ioe )
- {
- throw new BuildException( ioe.getMessage(), ioe );
+ } catch (final IOException ioe) {
+ throw new BuildException(ioe.getMessage(), ioe);
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java
index 49ef907cf..44d495f93 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java
@@ -63,19 +63,17 @@ import org.apache.tools.ant.BuildException;
* @todo Refactor this and all the other parameter, sysproperty,
* property etc into a single class in framework
*/
-public class ExtraAttribute
-{
- private String m_name;
- private String m_value;
+public class ExtraAttribute {
+ private String name;
+ private String value;
/**
* Set the name of the parameter.
*
* @param name the name of parameter
*/
- public void setName( final String name )
- {
- m_name = name;
+ public void setName(final String name) {
+ this.name = name;
}
/**
@@ -83,9 +81,8 @@ public class ExtraAttribute
*
* @param value the parameter value
*/
- public void setValue( final String value )
- {
- m_value = value;
+ public void setValue(final String value) {
+ this.value = value;
}
/**
@@ -93,9 +90,8 @@ public class ExtraAttribute
*
* @return the name of parameter.
*/
- String getName()
- {
- return m_name;
+ String getName() {
+ return name;
}
/**
@@ -103,27 +99,23 @@ public class ExtraAttribute
*
* @return the value of parameter.
*/
- String getValue()
- {
- return m_value;
+ String getValue() {
+ return value;
}
/**
* Make sure that neither the name or the value
* is null.
+ *
+ * @throws BuildException if the attribute is invalid.
*/
- public void validate()
- throws BuildException
- {
- if( null == m_name )
- {
+ public void validate() throws BuildException {
+ if (null == name) {
final String message = "Missing name from parameter.";
- throw new BuildException( message );
- }
- else if( null == m_value )
- {
- final String message = "Missing value from parameter " + m_name + ".";
- throw new BuildException( message );
+ throw new BuildException(message);
+ } else if (null == value) {
+ final String message = "Missing value from parameter " + name + ".";
+ throw new BuildException(message);
}
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java
index da253887a..fb6e3e946 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibFileSet.java
@@ -64,21 +64,20 @@ import org.apache.tools.ant.types.FileSet;
* @version $Revision$ $Date$
*/
public class LibFileSet
- extends FileSet
-{
+ extends FileSet {
/**
* Flag indicating whether should include the
* "Implementation-URL" attribute in manifest.
* Defaults to false.
*/
- private boolean m_includeURL;
+ private boolean includeURL;
/**
* Flag indicating whether should include the
* "Implementation-*" attributes in manifest.
* Defaults to false.
*/
- private boolean m_includeImpl;
+ private boolean includeImpl;
/**
* String that is the base URL for the librarys
@@ -94,7 +93,7 @@ public class LibFileSet
*
* Note that this also implies includeURL=true
*/
- private String m_urlBase;
+ private String urlBase;
/**
* Flag indicating whether should include the
@@ -102,11 +101,10 @@ public class LibFileSet
* Defaults to false.
*
* @param includeURL the flag
- * @see #m_includeURL
+ * @see #includeURL
*/
- public void setIncludeUrl( boolean includeURL )
- {
- m_includeURL = includeURL;
+ public void setIncludeUrl(boolean includeURL) {
+ this.includeURL = includeURL;
}
/**
@@ -115,22 +113,20 @@ public class LibFileSet
* Defaults to false.
*
* @param includeImpl the flag
- * @see #m_includeImpl
+ * @see #includeImpl
*/
- public void setIncludeImpl( boolean includeImpl )
- {
- m_includeImpl = includeImpl;
+ public void setIncludeImpl(boolean includeImpl) {
+ this.includeImpl = includeImpl;
}
/**
* Set the url base for fileset.
*
* @param urlBase the base url
- * @see #m_urlBase
+ * @see #urlBase
*/
- public void setUrlBase( String urlBase )
- {
- m_urlBase = urlBase;
+ public void setUrlBase(String urlBase) {
+ this.urlBase = urlBase;
}
/**
@@ -138,9 +134,8 @@ public class LibFileSet
*
* @return the includeURL flag.
*/
- boolean isIncludeURL()
- {
- return m_includeURL;
+ boolean isIncludeURL() {
+ return includeURL;
}
/**
@@ -148,9 +143,8 @@ public class LibFileSet
*
* @return the includeImpl flag.
*/
- boolean isIncludeImpl()
- {
- return m_includeImpl;
+ boolean isIncludeImpl() {
+ return includeImpl;
}
/**
@@ -158,8 +152,7 @@ public class LibFileSet
*
* @return the urlbase.
*/
- String getUrlBase()
- {
- return m_urlBase;
+ String getUrlBase() {
+ return urlBase;
}
}
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
index 14c9375f0..f177d6c3e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
@@ -66,8 +66,7 @@ import org.apache.tools.ant.BuildException;
* @author Peter Donald
* @version $Revision$ $Date$
*/
-class LibraryDisplayer
-{
+class LibraryDisplayer {
/**
* Display the extensions and specifications contained
* within specified file.
@@ -75,11 +74,10 @@ class LibraryDisplayer
* @param file the file
* @throws BuildException if fail to read file
*/
- void displayLibrary( final File file )
- throws BuildException
- {
- final Manifest manifest = ExtensionUtil.getManifest( file );
- displayLibrary( file, manifest );
+ void displayLibrary(final File file)
+ throws BuildException {
+ final Manifest manifest = ExtensionUtil.getManifest(file);
+ displayLibrary(file, manifest);
}
/**
@@ -90,65 +88,53 @@ class LibraryDisplayer
* @param manifest the manifest of file
* @throws BuildException if fail to read file
*/
- void displayLibrary( final File file,
- final Manifest manifest )
- throws BuildException
- {
- final Extension[] available = Extension.getAvailable( manifest );
- final Extension[] required = Extension.getRequired( manifest );
- final Extension[] options = Extension.getOptions( manifest );
- final Specification[] specifications = getSpecifications( manifest );
+ void displayLibrary(final File file,
+ final Manifest manifest)
+ throws BuildException {
+ final Extension[] available = Extension.getAvailable(manifest);
+ final Extension[] required = Extension.getRequired(manifest);
+ final Extension[] options = Extension.getOptions(manifest);
+ final Specification[] specifications = getSpecifications(manifest);
- if( 0 == available.length &&
- 0 == required.length &&
- 0 == options.length &&
- 0 == specifications.length )
- {
+ if (0 == available.length && 0 == required.length && 0 == options.length
+ && 0 == specifications.length) {
return;
}
final String message = "File: " + file;
final int size = message.length();
- printLine( size );
- System.out.println( message );
- printLine( size );
- if( 0 != available.length )
- {
- System.out.println( "Extensions Supported By Library:" );
- for( int i = 0; i < available.length; i++ )
- {
+ printLine(size);
+ System.out.println(message);
+ printLine(size);
+ if (0 != available.length) {
+ System.out.println("Extensions Supported By Library:");
+ for (int i = 0; i < available.length; i++) {
final Extension extension = available[ i ];
- System.out.println( extension.toString() );
+ System.out.println(extension.toString());
}
}
- if( 0 != required.length )
- {
- System.out.println( "Extensions Required By Library:" );
- for( int i = 0; i < required.length; i++ )
- {
+ if (0 != required.length) {
+ System.out.println("Extensions Required By Library:");
+ for (int i = 0; i < required.length; i++) {
final Extension extension = required[ i ];
- System.out.println( extension.toString() );
+ System.out.println(extension.toString());
}
}
- if( 0 != options.length )
- {
- System.out.println( "Extensions that will be used by Library if present:" );
- for( int i = 0; i < options.length; i++ )
- {
+ if (0 != options.length) {
+ System.out.println("Extensions that will be used by Library if present:");
+ for (int i = 0; i < options.length; i++) {
final Extension extension = options[ i ];
- System.out.println( extension.toString() );
+ System.out.println(extension.toString());
}
}
- if( 0 != specifications.length )
- {
- System.out.println( "Specifications Supported By Library:" );
- for( int i = 0; i < specifications.length; i++ )
- {
+ if (0 != specifications.length) {
+ System.out.println("Specifications Supported By Library:");
+ for (int i = 0; i < specifications.length; i++) {
final Specification specification = specifications[ i ];
- displaySpecification( specification );
+ displaySpecification(specification);
}
}
}
@@ -158,11 +144,9 @@ class LibraryDisplayer
*
* @param size the number of dashes to printout
*/
- private void printLine( final int size )
- {
- for( int i = 0; i < size; i++ )
- {
- System.out.print( "-" );
+ private void printLine(final int size) {
+ for (int i = 0; i < size; i++) {
+ System.out.print("-");
}
System.out.println();
}
@@ -174,16 +158,12 @@ class LibraryDisplayer
* @return the specifications or null if none
* @throws BuildException if malformed specification sections
*/
- private Specification[] getSpecifications( final Manifest manifest )
- throws BuildException
- {
- try
- {
- return Specification.getSpecifications( manifest );
- }
- catch( final ParseException pe )
- {
- throw new BuildException( pe.getMessage(), pe );
+ private Specification[] getSpecifications(final Manifest manifest)
+ throws BuildException {
+ try {
+ return Specification.getSpecifications(manifest);
+ } catch (final ParseException pe) {
+ throw new BuildException(pe.getMessage(), pe);
}
}
@@ -192,19 +172,16 @@ class LibraryDisplayer
*
* @param specification the specification
*/
- private void displaySpecification( final Specification specification )
- {
+ private void displaySpecification(final Specification specification) {
final String[] sections = specification.getSections();
- if( null != sections )
- {
- final StringBuffer sb = new StringBuffer( "Sections: " );
- for( int i = 0; i < sections.length; i++ )
- {
- sb.append( " " );
- sb.append( sections[ i ] );
+ if (null != sections) {
+ final StringBuffer sb = new StringBuffer("Sections: ");
+ for (int i = 0; i < sections.length; i++) {
+ sb.append(" ");
+ sb.append(sections[ i ]);
}
- System.out.println( sb );
+ System.out.println(sb);
}
- System.out.println( specification.toString() );
+ System.out.println(specification.toString());
}
}