Browse Source

<property file="..."> didn't resolve relative filenames correctly.

Reported by:	Marc Gemis <marc.gemis.mg@belgium.agfa.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267848 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
e868ebf02f
1 changed files with 8 additions and 7 deletions
  1. +8
    -7
      src/main/org/apache/tools/ant/taskdefs/Property.java

+ 8
- 7
src/main/org/apache/tools/ant/taskdefs/Property.java View File

@@ -70,7 +70,7 @@ public class Property extends Task {


String name; String name;
String value; String value;
String file;
File file;
String resource; String resource;


boolean userProperty=false; // set read-only properties boolean userProperty=false; // set read-only properties
@@ -91,11 +91,11 @@ public class Property extends Task {
return value; return value;
} }


public void setFile(String file) {
public void setFile(File file) {
this.file = file; this.file = file;
} }


public String getFile() {
public File getFile() {
return file; return file;
} }


@@ -122,15 +122,16 @@ public class Property extends Task {
} }
} }


private void loadFile (String name) throws BuildException {
private void loadFile (File file) throws BuildException {
Properties props = new Properties(); Properties props = new Properties();
log("Loading " + name, Project.MSG_VERBOSE); log("Loading " + name, Project.MSG_VERBOSE);
try { try {
if (new File(name).exists()) {
props.load(new FileInputStream(name));
if (file.exists()) {
props.load(new FileInputStream(file));
addProperties(props); addProperties(props);
} else { } else {
log("Unable to find " + name, Project.MSG_VERBOSE);
log("Unable to find " + file.getAbsolutePath(),
Project.MSG_VERBOSE);
} }
} catch(Exception ex) { } catch(Exception ex) {
throw new BuildException(ex.getMessage(), ex, location); throw new BuildException(ex.getMessage(), ex, location);


Loading…
Cancel
Save