summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorSzabolcs Berecz <szabolcs.berecz@gmail.com>2013-02-17 13:56:13 +0100
committerSzabolcs Berecz <szabolcs.berecz@gmail.com>2013-02-24 17:51:29 +0100
commit8187debb7148483d991b7fa131e0c66cdee6e646 (patch)
treee8c879e94010ac29540a592eb0c08c46a1cc7630 /src/library
parent2952d0fa020c003e919dff0eea0bc63f7d52fba8 (diff)
downloadscala-8187debb7148483d991b7fa131e0c66cdee6e646.tar.gz
scala-8187debb7148483d991b7fa131e0c66cdee6e646.tar.bz2
scala-8187debb7148483d991b7fa131e0c66cdee6e646.zip
SI-7074 Fix xml attribute sorting
Sorting the attributes of an xml element could drop some of the attributes. It was caused by the incorrect use of MetaData#copy() to concatenate "smaller" with the rest of the attributes. The MetaData#copy() method is similar to the following hypothetical method on a List: def copy(other: List): List = head :: other The fix prepends all elements of "smaller" to the rest of the attributes in the proper order.
Diffstat (limited to 'src/library')
-rwxr-xr-xsrc/library/scala/xml/Utility.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala
index 9429e9caa7..030a89773e 100755
--- a/src/library/scala/xml/Utility.scala
+++ b/src/library/scala/xml/Utility.scala
@@ -64,7 +64,7 @@ object Utility extends AnyRef with parsing.TokenTests {
val key = md.key
val smaller = sort(md.filter { m => m.key < key })
val greater = sort(md.filter { m => m.key > key })
- smaller.copy(md.copy ( greater ))
+ smaller.foldRight (md copy greater) ((x, xs) => x copy xs)
}
/** Return the node with its attribute list sorted alphabetically