Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 20696 invoked from network); 10 Dec 2004 05:51:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 10 Dec 2004 05:51:01 -0000 Received: (qmail 54160 invoked by uid 500); 10 Dec 2004 05:50:48 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 54116 invoked by uid 500); 10 Dec 2004 05:50:47 -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 54097 invoked by uid 99); 10 Dec 2004 05:50:47 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from Unknown (HELO mail.fts-vn.com) (210.245.44.131) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 09 Dec 2004 21:50:47 -0800 Received: from firewall ([210.245.44.130] helo=[172.16.1.104]) by mail.fts-vn.com with esmtp (Exim 4.34) id 1CcdZF-0001ET-2B for dev@ant.apache.org; Fri, 10 Dec 2004 12:43:49 +0700 Message-ID: <41B9392E.9050503@it.fts-vn.com> Date: Fri, 10 Dec 2004 12:50:38 +0700 From: Kev Jackson User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ant Developers List Subject: [Patch] javadoc and style fixes for org.apache.tools.ant.taskdefs.optional.extension.resolvers Content-Type: multipart/mixed; boundary="------------040303040508030304060005" X-unconfigured-debian-site-MailScanner: Found to be clean X-MailScanner-From: kevin.jackson@it.fts-vn.com X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --------------040303040508030304060005 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit - renamed variables (m_destdir ->destdir) - added javadoc for public methods and normal doc for private methods - slight tweak to remove "Unneccessary nested..." complaint from Eclipse Kev --------------040303040508030304060005 Content-Type: text/plain; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.txt" Index: URLResolver.java =================================================================== RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/resolvers/URLResolver.java,v retrieving revision 1.10 diff -u -r1.10 URLResolver.java --- URLResolver.java 9 Mar 2004 16:48:27 -0000 1.10 +++ URLResolver.java 10 Dec 2004 05:50:12 -0000 @@ -29,45 +29,66 @@ * * @version $Revision: 1.10 $ $Date: 2004/03/09 16:48:27 $ */ -public class URLResolver - implements ExtensionResolver { - private File m_destfile; - private File m_destdir; - private URL m_url; - +public class URLResolver implements ExtensionResolver { + private File destfile; + private File destdir; + private URL url; + + /** + * Sets the URL + * @param url the url + */ public void setUrl(final URL url) { - m_url = url; + this.url = url; } + /** + * Sets the destination file + * @param destfile the destination file + */ public void setDestfile(final File destfile) { - m_destfile = destfile; + this.destfile = destfile; } + /** + * Sets the destination directory + * @param destdir the destination directory + */ public void setDestdir(final File destdir) { - m_destdir = destdir; + this.destdir = destdir; } + /** + * Returns the file resolved from URL and directory + * @param extension the extention + * @param project the project + * @return file the file resolved + * @throws BuildException if the URL is invalid + */ public File resolve(final Extension extension, - final Project project) - throws BuildException { + final Project project) throws BuildException { validate(); - + final File file = getDest(); final Get get = (Get) project.createTask("get"); get.setDest(file); - get.setSrc(m_url); + get.setSrc(url); get.execute(); return file; } + /* + * Gets the destination file + */ private File getDest() { - if (null != m_destfile) { - return m_destfile; + File result; + if (null != destfile) { + result = destfile; } else { - final String file = m_url.getFile(); - String filename = null; + final String file = url.getFile(); + String filename; if (null == file || file.length() <= 1) { filename = "default.file"; } else { @@ -77,27 +98,34 @@ } filename = file.substring(index); } - - return new File(m_destdir, filename); + result = new File(destdir, filename); } + return result; } + /* + * Validates URL + */ private void validate() { - if (null == m_url) { + if (null == url) { final String message = "Must specify URL"; throw new BuildException(message); } - if (null == m_destdir && null == m_destfile) { + if (null == destdir && null == destfile) { final String message = "Must specify destination file or directory"; throw new BuildException(message); - } else if (null != m_destdir && null != m_destfile) { + } else if (null != destdir && null != destfile) { final String message = "Must not specify both destination file or directory"; throw new BuildException(message); } } + /** + * Returns a string representation of the URL + * @return the string representation + */ public String toString() { - return "URL[" + m_url + "]"; + return "URL[" + url + "]"; } } --------------040303040508030304060005 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org --------------040303040508030304060005--