costin 2002/12/28 23:31:26
Modified: src/main/org/apache/tools/ant RuntimeConfigurable.java
Log:
Fix the CRLF failure.
The test relies on the order of attributes ( cr set before eol ). Probably
other tasks are in the same situation.
The original change tried to reduce the dependencies on SAX - we may
use DOM or direct API calls in future, and the code will become very
complex. I just used the same thing that SAX is using ( 2 Vectors to
preserve the order ). We could also pick one ( SAX2 attributes ) and use
it in all cases.
Revision Changes Path
1.23 +12 -5
jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
Index: RuntimeConfigurable.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- RuntimeConfigurable.java 28 Dec 2002 21:25:43 -0000 1.22
+++ RuntimeConfigurable.java 29 Dec 2002 07:31:26 -0000 1.23
@@ -87,8 +87,14 @@
* XML attributes for the element. */
private transient AttributeList attributes;
- /** Attributes are stored in the attMap.
+ /** Attribute names and values. While the XML spec doesn't require
+ * preserving the order ( AFAIK ), some ant tests do rely on the
+ * exact order. The following code is copied from AttributeImpl.
+ * We could also just use SAX2 Attributes and convert to SAX1 ( DOM
+ * attribute Nodes can also be stored in SAX2 Attributges )
*/
+ private Vector attNames=new Vector();
+ private Vector attValues=new Vector();
private Hashtable attMap=new Hashtable();
/** Text appearing within the element. */
@@ -141,6 +147,8 @@
}
public void setAttribute( String name, String value ) {
+ attNames.addElement( name );
+ attValues.addElement( value );
attMap.put( name, value );
}
@@ -294,10 +302,9 @@
IntrospectionHelper ih =
IntrospectionHelper.getHelper(p, target.getClass());
- Enumeration attNames=attMap.keys();
- while( attNames.hasMoreElements() ) {
- String name=(String) attNames.nextElement();
- String value=(String) attMap.get(name);
+ for( int i=0; i< attNames.size(); i++ ) {
+ String name=(String) attNames.elementAt(i);
+ String value=(String) attValues.elementAt(i);
// reflect these into the target
value = p.replaceProperties(value);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>