ASF Bugzilla – Attachment 18641 Details for
Bug 40093
ant.PropertyHelper reference not passed to called build
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches of Ant.java and PropertyFunction.java (patch.xml)
patch.txt (text/plain), 4.28 KB, created by
Stefano Marsili
on 2006-07-26 09:19:18 UTC
(
hide
)
Description:
Patches of Ant.java and PropertyFunction.java (patch.xml)
Filename:
MIME Type:
Creator:
Stefano Marsili
Created:
2006-07-26 09:19:18 UTC
Size:
4.28 KB
patch
obsolete
>Index: src/main/org/apache/tools/ant/PropertyHelper.java >=================================================================== >--- src/main/org/apache/tools/ant/PropertyHelper.java (revision 424540) >+++ src/main/org/apache/tools/ant/PropertyHelper.java (working copy) >@@ -44,7 +44,7 @@ > * > * @since Ant 1.6 > */ >-public class PropertyHelper { >+public class PropertyHelper implements Cloneable { > > private Project project; > private PropertyHelper next; >@@ -76,7 +76,24 @@ > > //override facility for subclasses to put custom hashtables in > >+ /** >+ * Clones an instance of this class. >+ * <p>Properties and hooks are not cloned.</p> >+ */ >+ public Object clone() throws CloneNotSupportedException { >+ PropertyHelper clone = (PropertyHelper)super.clone(); > >+ // since properties are set separately >+ // just reset as if newly constructed >+ clone.properties = new Hashtable(); >+ clone.userProperties = new Hashtable(); >+ clone.inheritedProperties = new Hashtable(); >+ // for backward compatibility >+ // not trying to clone hooks >+ clone.next = null; >+ return clone; >+ } >+ > // -------------------- Hook management -------------------- > > /** >Index: src/main/org/apache/tools/ant/taskdefs/Ant.java >=================================================================== >--- src/main/org/apache/tools/ant/taskdefs/Ant.java (revision 424540) >+++ src/main/org/apache/tools/ant/taskdefs/Ant.java (working copy) >@@ -1,5 +1,5 @@ > /* >- * Copyright 2000-2005 The Apache Software Foundation >+ * Copyright 2000-2006 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. >@@ -34,6 +34,7 @@ > import org.apache.tools.ant.Project; > import org.apache.tools.ant.ProjectComponent; > import org.apache.tools.ant.ProjectHelper; >+import org.apache.tools.ant.PropertyHelper; > import org.apache.tools.ant.Target; > import org.apache.tools.ant.Task; > import org.apache.tools.ant.MagicNames; >@@ -140,6 +141,53 @@ > } > > /** >+ * Creates a clone of the property helper >+ * if <var>inheritAll</var> is <code>true</code>. >+ */ >+ private void correctPropertyHelper() { >+ // A new attribute inheritPropertyHelper or similar >+ // would be better. With default = false would >+ // be fully backward compatible. Using inheritAll >+ // instead causes problems to subclasses of >+ // PropertyHelper which don't expect to be cloned >+ // in the subbuild. Hopefully they don't exist. >+ if (!inheritAll) { >+ // not cloning the property helper >+ return; >+ } >+ PropertyHelper thisHelper = (PropertyHelper) getProject() >+ .getReference(MagicNames.REFID_PROPERTY_HELPER); >+ if (thisHelper == null) { >+ // no helper to clone >+ return; >+ } >+ >+ PropertyHelper newHelper = null; >+ try { >+ newHelper = (PropertyHelper)thisHelper.clone(); >+ } catch (CloneNotSupportedException cnse) { >+ //log("Couln't clone PropertyHelper", Project.MSG_VERBOSE); >+ } >+ if (newHelper != null) { >+ newHelper.setProject(newProject); >+ PropertyHelper tempHelper >+ = PropertyHelper.getPropertyHelper(newProject); >+ newProject.addReference(MagicNames.REFID_PROPERTY_HELPER >+ , newHelper); >+ // steal the properties >+ tempHelper.copyInheritedProperties(newProject); >+ tempHelper.copyUserProperties(newProject); >+ Hashtable props = tempHelper.getProperties(); >+ Enumeration e = props.keys(); >+ while (e.hasMoreElements()) { >+ String name = e.nextElement().toString(); >+ Object value = props.get(name); >+ newProject.setNewProperty(name, value.toString()); >+ } >+ } >+ } >+ >+ /** > * Creates a Project instance for the project to call. > */ > public void init() { >@@ -286,6 +334,7 @@ > if (newProject == null) { > reinit(); > } >+ correctPropertyHelper(); > > if ((dir == null) && (inheritAll)) { > dir = getProject().getBaseDir();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 40093
:
18624
|
18638
|
18639
|
18640
|
18641
|
18659
|
18662