Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 12017 invoked from network); 6 Jan 2005 11:15:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 6 Jan 2005 11:15:42 -0000 Received: (qmail 4939 invoked by uid 500); 6 Jan 2005 11:15:41 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 4665 invoked by uid 500); 6 Jan 2005 11:15:39 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 4633 invoked by uid 500); 6 Jan 2005 11:15:39 -0000 Received: (qmail 4622 invoked by uid 99); 6 Jan 2005 11:15:39 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Thu, 06 Jan 2005 03:15:39 -0800 Received: (qmail 11980 invoked by uid 1539); 6 Jan 2005 11:15:37 -0000 Date: 6 Jan 2005 11:15:37 -0000 Message-ID: <20050106111537.11979.qmail@minotaur.apache.org> From: peterreilly@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Checksum.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N peterreilly 2005/01/06 03:15:37 Modified: src/main/org/apache/tools/ant/taskdefs Checksum.java Log: checkstyle Revision Changes Path 1.43 +37 -6 ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java Index: Checksum.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- Checksum.java 6 Jan 2005 11:11:04 -0000 1.42 +++ Checksum.java 6 Jan 2005 11:15:37 -0000 1.43 @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -136,6 +136,7 @@ /** * Sets the file for which the checksum is to be calculated. + * @param file a File value */ public void setFile(File file) { this.file = file; @@ -144,7 +145,7 @@ /** * Sets the root directory where checksum files will be * written/read - * + * @param todir the directory to write to * @since Ant 1.6 */ public void setTodir(File todir) { @@ -154,6 +155,7 @@ /** * Specifies the algorithm to be used to compute the checksum. * Defaults to "MD5". Other popular algorithms like "SHA" may be used as well. + * @param algorithm a String value */ public void setAlgorithm(String algorithm) { this.algorithm = algorithm; @@ -162,6 +164,7 @@ /** * Sets the MessageDigest algorithm provider to be used * to calculate the checksum. + * @param provider a String value */ public void setProvider(String provider) { this.provider = provider; @@ -170,6 +173,7 @@ /** * Sets the file extension that is be to used to * create or identify destination file. + * @param fileext a String value */ public void setFileext(String fileext) { this.fileext = fileext; @@ -177,6 +181,7 @@ /** * Sets the property to hold the generated checksum. + * @param property a String value */ public void setProperty(String property) { this.property = property; @@ -185,6 +190,7 @@ /** * Sets the property to hold the generated total checksum * for all files. + * @param totalproperty a String value * * @since Ant 1.6 */ @@ -195,6 +201,7 @@ /** * Sets the verify property. This project property holds * the result of a checksum verification - "true" or "false" + * @param verifyProperty a String value */ public void setVerifyproperty(String verifyProperty) { this.verifyProperty = verifyProperty; @@ -204,6 +211,7 @@ * Whether or not to overwrite existing file irrespective of * whether it is newer than * the source file. Defaults to false. + * @param forceOverwrite a boolean value */ public void setForceOverwrite(boolean forceOverwrite) { this.forceOverwrite = forceOverwrite; @@ -211,6 +219,7 @@ /** * The size of the read buffer to use. + * @param size an int value */ public void setReadBufferSize(int size) { this.readBufferSize = size; @@ -218,6 +227,7 @@ /** * Select the in/output pattern via a well know format name. + * @param e an enumerated value * * @since 1.7.0 */ @@ -229,6 +239,7 @@ * Specify the pattern to use as a MessageFormat pattern. * *

{0} gets replaced by the checksum, {1} by the filename.

+ * @param p a String value * * @since 1.7.0 */ @@ -238,6 +249,7 @@ /** * Files to generate checksums for. + * @param set a fileset of files to generate checksums for. */ public void addFileset(FileSet set) { filesets.addElement(set); @@ -245,13 +257,15 @@ /** * Calculate the checksum(s). + * @throws BuildException on error */ public void execute() throws BuildException { isCondition = false; boolean value = validateAndExecute(); if (verifyProperty != null) { - getProject().setNewProperty(verifyProperty, - new Boolean(value).toString()); + getProject().setNewProperty( + verifyProperty, + (value ? Boolean.TRUE.toString() : Boolean.FALSE.toString())); } } @@ -260,6 +274,7 @@ * * @return Returns true if the checksum verification test passed, * false otherwise. + * @throws BuildException on error */ public boolean eval() throws BuildException { isCondition = true; @@ -295,7 +310,7 @@ if (property != null) { if (forceOverwrite) { throw new BuildException( - "ForceOverwrite cannot be used when Property is specified"); + "ForceOverwrite cannot be used when Property is specified"); } if (file != null) { @@ -453,7 +468,7 @@ DigestInputStream dis = new DigestInputStream(fis, messageDigest); while (dis.read(buf, 0, readBufferSize) != -1) { - ; + // Empty statement } dis.close(); fis.close(); @@ -566,6 +581,9 @@ * number of elements. * * NOTE: This code is copied from jakarta-commons codec. + * @param data an array of characters representing hexadecimal values + * @return the converted array of bytes + * @throws BuildException on error */ public static byte[] decodeHex(char[] data) throws BuildException { int l = data.length; @@ -632,20 +650,33 @@ formatMap.put(SVF, new MessageFormat("MD5 ({1}) = {0}")); } + /** Constructor for FormatElement */ public FormatElement() { super(); } + /** + * Get the default value - CHECKSUM. + * @return the defaul value. + */ public static FormatElement getDefault() { FormatElement e = new FormatElement(); e.setValue(CHECKSUM); return e; } + /** + * Convert this enumerated type to a MessageFormat. + * @return a MessageFormat object. + */ public MessageFormat getFormat() { return (MessageFormat) formatMap.get(getValue()); } + /** + * Get the valid values. + * @return an array of values. + */ public String[] getValues() { return new String[] {CHECKSUM, MD5SUM, SVF}; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org