peterreilly 2003/12/17 07:37:27
Modified: src/main/org/apache/tools/ant Tag: ANT_16_BRANCH
IntrospectionHelper.java UnknownElement.java
src/main/org/apache/tools/ant/helper Tag: ANT_16_BRANCH
ProjectHelper2.java
Log:
sync with HEAD
Revision Changes Path
No revision
No revision
1.65.2.5 +5 -41
ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
Index: IntrospectionHelper.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
retrieving revision 1.65.2.4
retrieving revision 1.65.2.5
diff -u -r1.65.2.4 -r1.65.2.5
--- IntrospectionHelper.java 11 Dec 2003 17:25:07 -0000 1.65.2.4
+++ IntrospectionHelper.java 17 Dec 2003 15:37:27 -0000 1.65.2.5
@@ -603,45 +603,6 @@
throw new BuildException(msg);
}
- private NestedCreator getNestedCreator(Project project, Object parent,
- String elementName) throws BuildException {
-
- NestedCreator nc = (NestedCreator) nestedCreators.get(
- elementName.toLowerCase(Locale.US));
- if (nc == null) {
- nc = createAddTypeCreator(project, parent, elementName);
- }
- if (nc == null && parent instanceof DynamicConfigurator) {
- DynamicConfigurator dc = (DynamicConfigurator) parent;
- final Object nestedElement =
dc.createDynamicElement(elementName);
- if (nestedElement != null) {
- nc = new NestedCreator() {
- public boolean isPolyMorphic() {
- return false;
- }
- public Class getElementClass() {
- return null;
- }
-
- public Object getRealObject() {
- return null;
- }
-
- public Object create(
- Project project, Object parent, Object ignore) {
- return nestedElement;
- }
- public void store(Object parent, Object child) {
- }
- };
- }
- }
- if (nc == null) {
- throwNotSupported(project, parent, elementName);
- }
- return nc;
- }
-
private NestedCreator getNestedCreator(
Project project, String parentUri, Object parent,
String elementName) throws BuildException {
@@ -705,6 +666,7 @@
* Must not be <code>null</code>.
*
* @return an instance of the specified element type
+ * @deprecated This is not a namespace aware method.
*
* @exception BuildException if no method is available to create the
* element instance, or if the creating method
@@ -712,7 +674,7 @@
*/
public Object createElement(Project project, Object parent,
String elementName) throws BuildException {
- NestedCreator nc = getNestedCreator(project, parent, elementName);
+ NestedCreator nc = getNestedCreator(project, "", parent,
elementName);
try {
Object nestedElement = nc.create(project, parent, null);
if (project != null) {
@@ -743,11 +705,13 @@
* @param parent Parent object used to create the creator object to
* create and store and instance of a subelement.
* @param elementName Name of the element to create an instance of.
+ * @param ue The unknown element associated with the element.
* @return a creator object to create and store the element instance.
*/
public Creator getElementCreator(
- Project project, String parentUri, Object parent, String
elementName) {
+ Project project, String parentUri, Object parent, String elementName,
+ UnknownElement ue) {
NestedCreator nc = getNestedCreator(
project, parentUri, parent, elementName);
return new Creator(project, parent, nc);
1.63.2.7 +2 -1 ant/src/main/org/apache/tools/ant/UnknownElement.java
Index: UnknownElement.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/UnknownElement.java,v
retrieving revision 1.63.2.6
retrieving revision 1.63.2.7
diff -u -r1.63.2.6 -r1.63.2.7
--- UnknownElement.java 24 Nov 2003 09:20:41 -0000 1.63.2.6
+++ UnknownElement.java 17 Dec 2003 15:37:27 -0000 1.63.2.7
@@ -564,7 +564,8 @@
child.getNamespace(), child.getTag());
if (ih.supportsNestedElement(parentUri, childName)) {
IntrospectionHelper.Creator creator =
- ih.getElementCreator(getProject(), parentUri, parent,
childName);
+ ih.getElementCreator(
+ getProject(), parentUri, parent, childName, child);
creator.setPolyType(childWrapper.getPolyType());
Object realChild = creator.create();
if (realChild instanceof PreSetDef.PreSetDefinition) {
No revision
No revision
1.33.2.5 +6 -10
ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
Index: ProjectHelper2.java
===================================================================
RCS file:
/home/cvs/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
retrieving revision 1.33.2.4
retrieving revision 1.33.2.5
diff -u -r1.33.2.4 -r1.33.2.5
--- ProjectHelper2.java 18 Nov 2003 17:07:24 -0000 1.33.2.4
+++ ProjectHelper2.java 17 Dec 2003 15:37:27 -0000 1.33.2.5
@@ -272,7 +272,7 @@
+ buildFileName + " is invalid.",
exc);
} catch (IOException exc) {
- throw new BuildException("Error reading project file "
+ throw new BuildException("Error reading project file "
+ buildFileName + ": " +
exc.getMessage(),
exc);
} finally {
@@ -484,9 +484,6 @@
*/
public void startElement(String uri, String tag, String qname,
Attributes attrs)
throws SAXParseException {
- if (uri.equals(ANT_CORE_URI)) {
- uri = "";
- }
AntHandler next
= currentHandler.onStartChild(uri, tag, qname, attrs,
context);
antHandlers.push(currentHandler);
@@ -519,9 +516,6 @@
*
*/
public void endElement(String uri, String name, String qName) throws
SAXException {
- if (uri.equals(ANT_CORE_URI)) {
- uri = "";
- }
currentHandler.onEndElement(uri, name, context);
AntHandler prev = (AntHandler) antHandlers.pop();
currentHandler = prev;
@@ -585,7 +579,8 @@
Attributes attrs,
AntXMLContext context)
throws SAXParseException {
- if (name.equals("project") && uri.equals("")) {
+ if (name.equals("project")
+ && (uri.equals("") || uri.equals(ANT_CORE_URI))) {
return ProjectHelper2.projectHandler;
} else {
// if (context.importlevel > 0) {
@@ -653,7 +648,7 @@
}
String key = attrs.getLocalName(i);
String value = attrs.getValue(i);
-
+
if (key.equals("default")) {
if (value != null && !value.equals("")) {
if (!context.isIgnoringProjectTag()) {
@@ -756,7 +751,8 @@
Attributes attrs,
AntXMLContext context)
throws SAXParseException {
- if (name.equals("target") && uri.equals("")) {
+ if (name.equals("target")
+ && (uri.equals("") || uri.equals(ANT_CORE_URI))) {
return ProjectHelper2.targetHandler;
} else {
return ProjectHelper2.elementHandler;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]