Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 30931 invoked from network); 12 Apr 2002 08:49:08 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 12 Apr 2002 08:49:08 -0000 Received: (qmail 5249 invoked by uid 97); 12 Apr 2002 08:49:17 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@jakarta.apache.org Received: (qmail 5171 invoked by uid 97); 12 Apr 2002 08:49:17 -0000 Mailing-List: contact ant-dev-help@jakarta.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 ant-dev@jakarta.apache.org Received: (qmail 5160 invoked by uid 97); 12 Apr 2002 08:49:16 -0000 Date: 12 Apr 2002 08:49:02 -0000 Message-ID: <20020412084902.11647.qmail@icarus.apache.org> From: bodewig@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Property.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bodewig 02/04/12 01:49:02 Modified: src/main/org/apache/tools/ant/taskdefs Property.java Log: didn't close input stream in resource case. Cosmetics. Revision Changes Path 1.46 +33 -15 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java Index: Property.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- Property.java 25 Feb 2002 11:03:40 -0000 1.45 +++ Property.java 12 Apr 2002 08:49:02 -0000 1.46 @@ -76,6 +76,7 @@ * @author costin@dnt.ro * @author Sam Ruby * @author Glenn McAllister + * @since Ant 1.1 */ public class Property extends Task { @@ -94,6 +95,9 @@ super(); } + /** + * @since Ant 1.5 + */ protected Property(boolean userProperty) { this.userProperty = userProperty; } @@ -129,7 +133,7 @@ public void setPrefix(String prefix) { this.prefix = prefix; if (!prefix.endsWith(".")) { - this.prefix += "."; + this.prefix += "."; } } @@ -177,11 +181,12 @@ } /** - * @deprecated This was never a supported feature and has been deprecated without replacement + * @deprecated This was never a supported feature and has been + * deprecated without replacement */ public void setUserProperty(boolean userProperty) { - log("DEPRECATED: Ignoring request to set user property in Property task.", - Project.MSG_WARN); + log("DEPRECATED: Ignoring request to set user property in Property" + + " task.", Project.MSG_WARN); } public String toString() { @@ -191,18 +196,21 @@ public void execute() throws BuildException { if (name != null) { if (value == null && ref == null) { - throw new BuildException("You must specify value, location or refid with the name attribute", + throw new BuildException("You must specify value, location or " + + "refid with the name attribute", location); } } else { if (file == null && resource == null && env == null) { - throw new BuildException("You must specify file, resource or environment when not using the name attribute", - location); + throw new BuildException("You must specify file, resource or " + + "environment when not using the " + + "name attribute", location); } } if (file == null && resource == null && prefix != null) { - throw new BuildException("Prefix is only valid when loading from a file or resource", location); + throw new BuildException("Prefix is only valid when loading from " + + "a file or resource", location); } if ((name != null) && (value != null)) { @@ -210,15 +218,15 @@ } if (file != null) { - loadFile(file); + loadFile(file); } if (resource != null) { - loadResource(resource); + loadResource(resource); } if (env != null) { - loadEnvironment(env); + loadEnvironment(env); } if ((name != null) && (ref != null)) { @@ -255,9 +263,9 @@ protected void loadResource(String name) { Properties props = new Properties(); log("Resource Loading " + name, Project.MSG_VERBOSE); + InputStream is = null; try { ClassLoader cL = null; - InputStream is = null; if (classpath != null) { cL = new AntClassLoader(project, classpath); @@ -279,13 +287,20 @@ } } catch (IOException ex) { throw new BuildException(ex, location); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) {} + } } + } protected void loadEnvironment( String prefix ) { Properties props = new Properties(); if (!prefix.endsWith(".")) { - prefix += "."; + prefix += "."; } log("Loading Environment " + prefix, Project.MSG_VERBOSE); Vector osEnv = Execute.getProcEnvironment(); @@ -340,7 +355,8 @@ while (!resolved) { Vector fragments = new Vector(); Vector propertyRefs = new Vector(); - ProjectHelper.parsePropertyString(value, fragments, propertyRefs); + ProjectHelper.parsePropertyString(value, fragments, + propertyRefs); resolved = true; if (propertyRefs.size() != 0) { @@ -352,7 +368,9 @@ if (fragment == null) { String propertyName = (String)j.nextElement(); if (propertyName.equals(name)) { - throw new BuildException("Property " + name + " was circularly defined."); + throw new BuildException("Property " + name + + " was circularly " + + "defined."); } fragment = getProject().getProperty(propertyName); if (fragment == null) { -- To unsubscribe, e-mail: For additional commands, e-mail: