Author: mbenson Date: Tue Jul 17 10:31:54 2007 New Revision: 556984 URL: http://svn.apache.org/viewvc?view=rev&rev=556984 Log: fmt/refac
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java?view=diff&rev=556984&r1=556983&r2=556984 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java Tue Jul 17 10:31:54 2007 @@ -101,11 +101,9 @@ * in the library. */ public void addConfiguredExtension(final ExtensionAdapter extensionAdapter) - throws BuildException { + throws BuildException { if (null != extension) { - final String message = - "Can not have multiple extensions defined in one library."; - throw new BuildException(message); + throw new BuildException("Can not have multiple extensions defined in one library."); } extension = extensionAdapter.toExtension(); } @@ -149,8 +147,8 @@ final Attributes attributes = manifest.getMainAttributes(); attributes.put(Attributes.Name.MANIFEST_VERSION, MANIFEST_VERSION); - final String createdBy = "Apache Ant " + getProject().getProperty(MagicNames.ANT_VERSION); - attributes.putValue(CREATED_BY, createdBy); + attributes.putValue(CREATED_BY, "Apache Ant " + + getProject().getProperty(MagicNames.ANT_VERSION)); appendExtraAttributes(attributes); @@ -160,24 +158,17 @@ //Add all the dependency data to manifest for dependencies final ArrayList depends = toExtensions(dependencies); - appendExtensionList(attributes, - Extension.EXTENSION_LIST, - "lib", - depends.size()); + appendExtensionList(attributes, Extension.EXTENSION_LIST, "lib", depends.size()); appendLibraryList(attributes, "lib", depends); - //Add all the dependency data to manifest for "optional" + // Add all the dependency data to manifest for "optional" //dependencies final ArrayList option = toExtensions(optionals); - appendExtensionList(attributes, - Extension.OPTIONAL_EXTENSION_LIST, - "opt", - option.size()); + appendExtensionList(attributes, Extension.OPTIONAL_EXTENSION_LIST, "opt", option.size()); appendLibraryList(attributes, "opt", option); try { - final String message = "Generating manifest " + destFile.getAbsoluteFile(); - log(message, Project.MSG_INFO); + log("Generating manifest " + destFile.getAbsoluteFile(), Project.MSG_INFO); writeManifest(manifest); } catch (final IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); @@ -191,12 +182,10 @@ */ private void validate() throws BuildException { if (null == destFile) { - final String message = "Destfile attribute not specified."; - throw new BuildException(message); + throw new BuildException("Destfile attribute not specified."); } if (destFile.exists() && !destFile.isFile()) { - final String message = destFile + " is not a file."; - throw new BuildException(message); + throw new BuildException(destFile + " is not a file."); } } @@ -222,8 +211,7 @@ * @param manifest the manifest * @throws IOException if error writing file */ - private void writeManifest(final Manifest manifest) - throws IOException { + private void writeManifest(final Manifest manifest) throws IOException { FileOutputStream output = null; try { output = new FileOutputStream(destFile); @@ -251,10 +239,8 @@ * @param extensions the list of extensions * @throws BuildException if an error occurs */ - private void appendLibraryList(final Attributes attributes, - final String listPrefix, - final ArrayList extensions) - throws BuildException { + private void appendLibraryList(final Attributes attributes, final String listPrefix, + final ArrayList extensions) throws BuildException { final int size = extensions.size(); for (int i = 0; i < size; i++) { final Extension ext = (Extension) extensions.get(i); @@ -275,16 +261,13 @@ * @param extensionKey the key to use */ private void appendExtensionList(final Attributes attributes, - final Attributes.Name extensionKey, - final String listPrefix, - final int size) { + final Attributes.Name extensionKey, final String listPrefix, final int size) { final StringBuffer sb = new StringBuffer(); for (int i = 0; i < size; i++) { sb.append(listPrefix); sb.append(i); sb.append(' '); } - //add in something like //"Extension-List: javahelp java3d" attributes.put(extensionKey, sb.toString()); @@ -296,8 +279,7 @@ * @param extensionSets the list of ExtensionSets to add to list * @throws BuildException if an error occurs */ - private ArrayList toExtensions(final ArrayList extensionSets) - throws BuildException { + private ArrayList toExtensions(final ArrayList extensionSets) throws BuildException { final ArrayList results = new ArrayList(); final int size = extensionSets.size(); @@ -308,7 +290,6 @@ results.add(extensions[ j ]); } } - return results; } } Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java?view=diff&rev=556984&r1=556983&r2=556984 ============================================================================== --- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java (original) +++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java Tue Jul 17 10:31:54 2007 @@ -146,11 +146,9 @@ public void execute() throws BuildException { validate(); - getProject().log("Resolving extension: " + requiredExtension, - Project.MSG_VERBOSE); + getProject().log("Resolving extension: " + requiredExtension, Project.MSG_VERBOSE); - String candidate = - getProject().getProperty(propertyName); + String candidate = getProject().getProperty(propertyName); if (null != candidate) { final String message = "Property Already set to: " + candidate; @@ -167,27 +165,24 @@ (ExtensionResolver) resolvers.get(i); getProject().log("Searching for extension using Resolver:" + resolver, - Project.MSG_VERBOSE); + Project.MSG_VERBOSE); try { - final File file = - resolver.resolve(requiredExtension, getProject()); + final File file = resolver.resolve(requiredExtension, getProject()); try { checkExtension(file); return; } catch (final BuildException be) { final String message = "File " + file + " returned by " - + "resolver failed to satisfy extension due to: " - + be.getMessage(); + + "resolver failed to satisfy extension due to: " + be.getMessage(); getProject().log(message, Project.MSG_WARN); } } catch (final BuildException be) { - final String message = "Failed to resolve extension to file " - + "using resolver " + resolver + " due to: " + be; + final String message = "Failed to resolve extension to file " + "using resolver " + + resolver + " due to: " + be; getProject().log(message, Project.MSG_WARN); } } - missingExtension(); } @@ -197,8 +192,7 @@ * a warning. */ private void missingExtension() { - final String message = - "Unable to resolve extension to a file"; + final String message = "Unable to resolve extension to a file"; if (failOnError) { throw new BuildException(message); } @@ -215,28 +209,20 @@ */ private void checkExtension(final File file) { if (!file.exists()) { - final String message = - "File " + file + " does not exist"; - throw new BuildException(message); + throw new BuildException("File " + file + " does not exist"); } if (!file.isFile()) { - final String message = - "File " + file + " is not a file"; - throw new BuildException(message); + throw new BuildException("File " + file + " is not a file"); } - if (!checkExtension) { - final String message = "Setting property to " + file - + " without verifying library satisfies extension"; - getProject().log(message, Project.MSG_VERBOSE); + getProject().log("Setting property to " + file + + " without verifying library satisfies extension", Project.MSG_VERBOSE); setLibraryProperty(file); } else { - getProject().log("Checking file " + file - + " to see if it satisfies extension", Project.MSG_VERBOSE); - final Manifest manifest = - ExtensionUtil.getManifest(file); - final Extension[] extensions = - Extension.getAvailable(manifest); + getProject().log("Checking file " + file + " to see if it satisfies extension", + Project.MSG_VERBOSE); + final Manifest manifest = ExtensionUtil.getManifest(file); + final Extension[] extensions = Extension.getAvailable(manifest); for (int i = 0; i < extensions.length; i++) { final Extension extension = extensions[ i ]; if (extension.isCompatibleWith(requiredExtension)) { @@ -244,12 +230,8 @@ return; } } - - getProject().log("File " + file + " skipped as it " - + "does not satisfy extension", Project.MSG_VERBOSE); - - final String message = - "File " + file + " does not satisfy extension"; + final String message = "File " + file + " skipped as it " + "does not satisfy extension"; + getProject().log(message, Project.MSG_VERBOSE); throw new BuildException(message); } } @@ -262,8 +244,7 @@ * @param file the library */ private void setLibraryProperty(final File file) { - getProject().setNewProperty(propertyName, - file.getAbsolutePath()); + getProject().setNewProperty(propertyName, file.getAbsolutePath()); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]