summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-01-13 14:38:37 +0000
committerPaul Phillips <paulp@improving.org>2010-01-13 14:38:37 +0000
commit4f2bcd1af4fc12765aea7975a97357274087d392 (patch)
tree9e1fdcc86f1cfc827e283356a33aa47ec2770850 /src/library
parent1b97738fcd26ad19cc5c3779409152c2ca88f295 (diff)
downloadscala-4f2bcd1af4fc12765aea7975a97357274087d392.tar.gz
scala-4f2bcd1af4fc12765aea7975a97357274087d392.tar.bz2
scala-4f2bcd1af4fc12765aea7975a97357274087d392.zip
A variety of bugfixes discovered by findbugs.
examples of equality comparisons which are guaranteed to return false because someone is not comparing what they think they're comparing.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/collection/mutable/FlatHashTable.scala2
-rw-r--r--src/library/scala/math/BigDecimal.scala2
-rw-r--r--src/library/scala/xml/Utility.scala7
3 files changed, 6 insertions, 5 deletions
diff --git a/src/library/scala/collection/mutable/FlatHashTable.scala b/src/library/scala/collection/mutable/FlatHashTable.scala
index 422559f089..0e73bf7fad 100644
--- a/src/library/scala/collection/mutable/FlatHashTable.scala
+++ b/src/library/scala/collection/mutable/FlatHashTable.scala
@@ -184,7 +184,7 @@ trait FlatHashTable[A] {
private def checkConsistent() {
for (i <- 0 until table.length)
if (table(i) != null && !containsEntry(table(i).asInstanceOf[A]))
- assert(false, i+" "+table(i)+" "+table.toString)
+ assert(false, i+" "+table(i)+" "+table.mkString)
}
protected def elemHashCode(elem: A) = if (elem == null) 0 else elem.hashCode()
diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala
index 2f3c7f131b..6bd6b33484 100644
--- a/src/library/scala/math/BigDecimal.scala
+++ b/src/library/scala/math/BigDecimal.scala
@@ -100,7 +100,7 @@ object BigDecimal
*/
def apply(x: Array[Char]): BigDecimal = apply(x, defaultMathContext)
def apply(x: Array[Char], mc: MathContext): BigDecimal =
- new BigDecimal(new BigDec(x.toString, mc), mc)
+ new BigDecimal(new BigDec(x.mkString, mc), mc)
/** Translates the decimal String representation of a <code>BigDecimal</code>
* into a <code>BigDecimal</code>.
diff --git a/src/library/scala/xml/Utility.scala b/src/library/scala/xml/Utility.scala
index 78c0ee9475..1cfe9c79c9 100644
--- a/src/library/scala/xml/Utility.scala
+++ b/src/library/scala/xml/Utility.scala
@@ -289,9 +289,10 @@ object Utility extends AnyRef with parsing.TokenTests
*/
def getName(s: String, index: Int): String = {
if (index >= s.length) null
- else (s drop index) match {
- case Seq(x, xs @ _*) if isNameStart(x) => x.toString + (xs takeWhile isNameChar).mkString
- case _ => ""
+ else {
+ val xs = s drop index
+ if (xs.nonEmpty && isNameStart(xs.head)) xs takeWhile isNameChar
+ else ""
}
}