Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 9769 invoked from network); 17 Jul 2007 21:43:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Jul 2007 21:43:35 -0000 Received: (qmail 60417 invoked by uid 500); 17 Jul 2007 21:43:31 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 60378 invoked by uid 500); 17 Jul 2007 21:43:31 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 60367 invoked by uid 99); 17 Jul 2007 21:43:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jul 2007 14:43:31 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=RCVD_IN_SORBS_WEB X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [206.190.58.154] (HELO web55105.mail.re4.yahoo.com) (206.190.58.154) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 17 Jul 2007 14:43:24 -0700 Received: (qmail 49460 invoked by uid 60001); 17 Jul 2007 21:43:03 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=NCzVlWGBiye2OmrItLJyIKoJgZ7lEd+6XKVGnbXmBHbwIOpBAGPhHprzaQkiDzuKBl1GwNuoCEpLsqFNApXq9r0k7UVAzJuEFnWO+iACUnx3YmBwMVlrZfJOXO6sOywoXZjLUMg/DdnXBzrutsND0bBcw4/rrjdP86CnFd/WToY=; X-YMail-OSG: iuldEfEVM1nkH6fu5iPP2.ZSKBvW2RqeJz_KQ84_1U1gllgfOSJ3QVucMW7kx28KiOTDkphjb3vxkXezSEoWsWy6duIiuXtKO0XruJ1MLlNYdk_VfqmvcFF0atdxhAvXE03JX0DigT9ygmpwWI.kYDndDw-- Received: from [67.142.130.32] by web55105.mail.re4.yahoo.com via HTTP; Tue, 17 Jul 2007 14:43:02 PDT Date: Tue, 17 Jul 2007 14:43:02 -0700 (PDT) From: Matt Benson Subject: Re: svn commit: r557062 - /ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java To: Ant Developers List In-Reply-To: <20070717213528.25B761A981A@eris.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <129094.47988.qm@web55105.mail.re4.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org The refactoring is much bigger than the formatting here, FYI... wanted to reassure you that I am taking your comments to heart, Peter. -Matt --- mbenson@apache.org wrote: > Author: mbenson > Date: Tue Jul 17 14:35:26 2007 > New Revision: 557062 > > URL: > http://svn.apache.org/viewvc?view=rev&rev=557062 > Log: > fmt/refac > > Modified: > > ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java > > Modified: > ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java > URL: > http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java?view=diff&rev=557062&r1=557061&r2=557062 > ============================================================================== > --- > ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java > (original) > +++ > ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java > Tue Jul 17 14:35:26 2007 > @@ -76,8 +76,7 @@ > * @param resource resource on classpath > */ > public void setResource(String resource) { > - assertSrcIsJavaResource(); > - ((JavaResource) src).setName(resource); > + > getRequiredJavaResource().setName(resource); > } > > /** > @@ -100,8 +99,7 @@ > * @param classpath to add to any existing > classpath > */ > public void setClasspath(Path classpath) { > - assertSrcIsJavaResource(); > - ((JavaResource) > src).setClasspath(classpath); > + > getRequiredJavaResource().setClasspath(classpath); > } > > /** > @@ -109,8 +107,7 @@ > * @return The classpath to be configured > */ > public Path createClasspath() { > - assertSrcIsJavaResource(); > - return ((JavaResource) > src).createClasspath(); > + return > getRequiredJavaResource().createClasspath(); > } > > /** > @@ -119,8 +116,7 @@ > * @param r The reference value > */ > public void setClasspathRef(Reference r) { > - assertSrcIsJavaResource(); > - ((JavaResource) src).setClasspathRef(r); > + > getRequiredJavaResource().setClasspathRef(r); > } > > /** > @@ -128,8 +124,7 @@ > * @return The classpath > */ > public Path getClasspath() { > - assertSrcIsJavaResource(); > - return ((JavaResource) src).getClasspath(); > + return > getRequiredJavaResource().getClasspath(); > } > > /** > @@ -150,7 +145,6 @@ > } > throw new BuildException("Source > resource does not exist: " + src); > } > - > BufferedInputStream bis = null; > Reader instream = null; > ByteArrayInputStream tis = null; > @@ -162,7 +156,6 @@ > } else { > instream = new > InputStreamReader(bis, encoding); > } > - > ChainReaderHelper crh = new > ChainReaderHelper(); > crh.setPrimaryReader(instream); > crh.setFilterChains(filterChains); > @@ -175,7 +168,6 @@ > if (!text.endsWith("\n")) { > text = text + "\n"; > } > - > if (encoding == null) { > tis = new > ByteArrayInputStream(text.getBytes()); > } else { > @@ -188,10 +180,8 @@ > propertyTask.bindToOwner(this); > propertyTask.addProperties(props); > } > - > } catch (final IOException ioe) { > - final String message = "Unable to load > file: " + ioe.toString(); > - throw new BuildException(message, ioe, > getLocation()); > + throw new BuildException("Unable to > load file: " + ioe, ioe, getLocation()); > } finally { > FileUtils.close(bis); > FileUtils.close(tis); > @@ -211,23 +201,24 @@ > * @param a the resource to load as a single > element Resource collection. > * @since Ant 1.7 > */ > - public void addConfigured(ResourceCollection a) > { > + public synchronized void > addConfigured(ResourceCollection a) { > if (src != null) { > throw new BuildException("only a single > source is supported"); > } > if (a.size() != 1) { > - throw new BuildException("only single > argument resource collections" > - + " are > supported"); > + throw new BuildException( > + "only single-element resource > collections are supported"); > } > src = (Resource) a.iterator().next(); > } > > - private void assertSrcIsJavaResource() { > + private synchronized JavaResource > getRequiredJavaResource() { > if (src == null) { > src = new JavaResource(); > src.setProject(getProject()); > } else if (!(src instanceof JavaResource)) > { > throw new BuildException("expected a > java resource as source"); > } > + return (JavaResource) src; > } > } > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > dev-unsubscribe@ant.apache.org > For additional commands, e-mail: > dev-help@ant.apache.org > > ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org