summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2006-10-10 14:25:20 +0000
committerBurak Emir <emir@epfl.ch>2006-10-10 14:25:20 +0000
commitde4eb301bc40ca4b7cb315843f660168451e728b (patch)
treed77ad3b9a71d4bdd8287a99f91163e96276d02fb /src
parent2995f1a6a4eb2c95399e125500ce6143f9ce7465 (diff)
downloadscala-de4eb301bc40ca4b7cb315843f660168451e728b.tar.gz
scala-de4eb301bc40ca4b7cb315843f660168451e728b.tar.bz2
scala-de4eb301bc40ca4b7cb315843f660168451e728b.zip
exceptions
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/Iterable.scala4
-rw-r--r--src/library/scala/Iterator.scala22
-rw-r--r--src/library/scala/List.scala20
-rw-r--r--src/library/scala/Option.scala5
-rw-r--r--src/library/scala/Seq.scala2
-rw-r--r--src/library/scala/Stream.scala12
-rw-r--r--src/library/scala/collection/Map.scala2
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala10
-rw-r--r--src/library/scala/collection/immutable/ListSet.scala16
-rw-r--r--src/library/scala/collection/immutable/Queue.scala13
-rw-r--r--src/library/scala/collection/immutable/Stack.scala10
-rw-r--r--src/library/scala/collection/immutable/Tree.scala14
-rw-r--r--src/library/scala/collection/mutable/Buffer.scala10
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala10
-rw-r--r--src/library/scala/collection/mutable/Map.scala4
-rw-r--r--src/library/scala/collection/mutable/Message.scala2
-rw-r--r--src/library/scala/collection/mutable/MutableList.scala2
-rw-r--r--src/library/scala/collection/mutable/ObservableBuffer.scala4
-rw-r--r--src/library/scala/collection/mutable/ObservableMap.scala4
-rw-r--r--src/library/scala/collection/mutable/ObservableSet.scala4
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala9
-rw-r--r--src/library/scala/collection/mutable/Queue.scala6
-rw-r--r--src/library/scala/collection/mutable/Set.scala4
-rw-r--r--src/library/scala/collection/mutable/SingleLinkedList.scala2
-rw-r--r--src/library/scala/collection/mutable/Stack.scala12
-rw-r--r--src/library/scala/concurrent/Actor.scala4
-rw-r--r--src/library/scala/concurrent/NameServer.scala4
-rw-r--r--src/library/scala/concurrent/Process.scala5
-rw-r--r--src/library/scala/io/BytePickle.scala6
-rw-r--r--src/library/scala/io/Position.scala6
-rwxr-xr-xsrc/library/scala/runtime/RichString.scala2
-rw-r--r--src/library/scala/util/automata/BaseBerrySethi.scala8
-rw-r--r--src/library/scala/xml/Elem.scala10
-rw-r--r--src/library/scala/xml/Group.scala30
-rw-r--r--src/library/scala/xml/NamespaceBinding.scala2
-rw-r--r--src/library/scala/xml/dtd/Decl.scala2
-rw-r--r--src/library/scala/xml/parsing/MarkupParser.scala6
-rw-r--r--src/library/scala/xml/parsing/ValidatingMarkupHandler.scala2
-rw-r--r--src/library/scala/xml/transform/BasicTransformer.scala2
39 files changed, 174 insertions, 118 deletions
diff --git a/src/library/scala/Iterable.scala b/src/library/scala/Iterable.scala
index 1c1a3915de..2ab18f1f7b 100644
--- a/src/library/scala/Iterable.scala
+++ b/src/library/scala/Iterable.scala
@@ -39,7 +39,7 @@ object Iterable {
/** The minimum element of a non-empty sequence of ordered elements */
def min[A <% Ordered[A]](seq: Iterable[A]): A = {
val xs = seq.elements
- if (!xs.hasNext) Predef.error("min(<empty>)")
+ if (!xs.hasNext) throw new IllegalArgumentException("min(<empty>)")
var min = xs.next
while (xs.hasNext) {
val x = xs.next
@@ -51,7 +51,7 @@ object Iterable {
/** The maximum element of a non-empty sequence of ordered elements */
def max[A <% Ordered[A]](seq: Iterable[A]): A = {
val xs = seq.elements
- if (!xs.hasNext) Predef.error("max(<empty>)")
+ if (!xs.hasNext) throw new IllegalArgumentException("max(<empty>)")
var max = xs.next
while (xs.hasNext) {
val x = xs.next
diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala
index 60774e9a05..54a3c92d62 100644
--- a/src/library/scala/Iterator.scala
+++ b/src/library/scala/Iterator.scala
@@ -25,7 +25,7 @@ object Iterator {
def empty[a] = new Iterator[a] {
def hasNext: Boolean = false
- def next: a = Predef.error("next on empty iterator")
+ def next: a = throw new java.util.NoSuchElementException("next on empty iterator")
}
def single[a](x: a) = new Iterator[a] {
@@ -33,7 +33,7 @@ object Iterator {
def hasNext: Boolean = hasnext
def next: a =
if (hasnext) { hasnext = false; x }
- else Predef.error("next on empty iterator")
+ else throw new java.util.NoSuchElementException("next on empty iterator")
}
def fromValues[a](xs: a*) = xs.elements
@@ -53,9 +53,9 @@ object Iterator {
val end = if ((start + length) < xs.length) start else xs.length
def hasNext: Boolean = i < end
def next: a = if (hasNext) { val x = xs(i) ; i = i + 1 ; x }
- else Predef.error("next on empty iterator")
+ else throw new java.util.NoSuchElementException("next on empty iterator")
def head: a = if (hasNext) xs(i);
- else Predef.error("head on empty iterator")
+ else throw new java.util.NoSuchElementException("head on empty iterator")
}
def fromString(str: String): Iterator[Char] =
@@ -103,10 +103,10 @@ object Iterator {
def hasNext: Boolean = if (step > 0) i < end else i > end
def next: Int =
if (hasNext) { val j = i; i = i + step; j }
- else Predef.error("next on empty iterator")
+ else throw new java.util.NoSuchElementException("next on empty iterator")
def head: Int =
if (hasNext) i
- else Predef.error("head on empty iterator")
+ else throw new java.util.NoSuchElementException("head on empty iterator")
}
}
@@ -126,10 +126,10 @@ object Iterator {
def hasNext: Boolean = i < end
def next: Int =
if (i < end) { val j = i; i = step(i); j }
- else Predef.error("next on empty iterator")
+ else throw new java.util.NoSuchElementException("next on empty iterator")
def head: Int =
if (i < end) i
- else Predef.error("head on empty iterator")
+ else throw new java.util.NoSuchElementException("head on empty iterator")
}
/** Create an iterator with elements
@@ -203,7 +203,7 @@ trait Iterator[+A] {
def hasNext = remaining > 0 && Iterator.this.hasNext
def next: A =
if (hasNext) { remaining = remaining - 1; Iterator.this.next }
- else error("next on empty iterator")
+ else throw new java.util.NoSuchElementException("next on empty iterator")
}
/** Removes the first <code>n</code> elements from this iterator.
@@ -247,7 +247,7 @@ trait Iterator[+A] {
else if (Iterator.this.hasNext) {
cur = f(Iterator.this.next)
next
- } else Predef.error("next on empty iterator")
+ } else throw new java.util.NoSuchElementException("next on empty iterator")
}
/** Returns an iterator over all the elements of this iterator that
@@ -270,7 +270,7 @@ trait Iterator[+A] {
def hasNext: Boolean = { skip; ahead || hasMore }
def next: A =
if (hasNext) { ahead = false; hd }
- else Predef.error("next on empty iterator");
+ else throw new java.util.NoSuchElementException("next on empty iterator");
def head: A = { skip; hd }
}
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala
index 6ef56ce773..c0b5aedd88 100644
--- a/src/library/scala/List.scala
+++ b/src/library/scala/List.scala
@@ -472,7 +472,7 @@ sealed abstract class List[+a] extends Seq[a] with CaseClass {
def hasNext: Boolean = !these.isEmpty
def next: a =
if (!hasNext)
- error("next on empty Iterator")
+ throw new java.util.NoSuchElementException("next on empty Iterator")
else {
val result = these.head; these = these.tail; result
}
@@ -491,7 +491,7 @@ sealed abstract class List[+a] extends Seq[a] with CaseClass {
* @throws <code>java.lang.RuntimeException</code> if the list is empty.
*/
def init: List[a] =
- if (isEmpty) error("Nil.init")
+ if (isEmpty) throw new UnsupportedOperationException("Nil.init")
else {
val b = new ListBuffer[a]
var elem = head
@@ -510,7 +510,7 @@ sealed abstract class List[+a] extends Seq[a] with CaseClass {
* @throws <code>java.lang.RuntimeException</code> if the list is empty.
*/
def last: a =
- if (isEmpty) error("Nil.last")
+ if (isEmpty) throw new UnsupportedOperationException("Nil.last")
else if (tail.isEmpty) head
else tail.last
@@ -906,12 +906,12 @@ sealed abstract class List[+a] extends Seq[a] with CaseClass {
}
def reduceLeft[b >: a](f: (b, b) => b): b = this match {
- case Nil => error("Nil.reduceLeft")
+ case Nil => throw new UnsupportedOperationException("Nil.reduceLeft")
case x :: xs => ((xs: List[b]) foldLeft (x: b))(f)
}
def reduceRight[b >: a](f: (b, b) => b): b = this match {
- case Nil => error("Nil.reduceRight")
+ case Nil => throw new UnsupportedOperationException("Nil.reduceRight")
case x :: Nil => x: b
case x :: xs => f(x, xs reduceRight f)
}
@@ -1090,8 +1090,14 @@ sealed abstract class List[+a] extends Seq[a] with CaseClass {
[SerialVersionUID(0 - 8256821097970055419L)]
case object Nil extends List[Nothing] {
override def isEmpty = true
- def head: All = error("head of empty list")
- def tail: List[Nothing] = error("tail of empty list")
+ /**
+ * @throws java.util.NoSuchElementException
+ */
+ def head: All = throw new java.util.NoSuchElementException("head of empty list")
+ /**
+ * @throws java.util.NoSuchElementException
+ */
+ def tail: List[Nothing] = throw new java.util.NoSuchElementException("tail of empty list")
}
/** A non empty list characterized by a head and a tail.
diff --git a/src/library/scala/Option.scala b/src/library/scala/Option.scala
index 1355b3ee24..636f32d59e 100644
--- a/src/library/scala/Option.scala
+++ b/src/library/scala/Option.scala
@@ -28,8 +28,11 @@ sealed abstract class Option[+A] extends Iterable[A] with CaseClass {
case _ => false
}
+ /**
+ * @throws java.util.NoSuchElementException
+ */
def get: A = this match {
- case None => Predef.error("None.get")
+ case None => throw new java.util.NoSuchElementException("None.get")
case Some(x) => x
}
diff --git a/src/library/scala/Seq.scala b/src/library/scala/Seq.scala
index a52c54c020..8c9f896814 100644
--- a/src/library/scala/Seq.scala
+++ b/src/library/scala/Seq.scala
@@ -156,7 +156,7 @@ trait Seq[+A] extends AnyRef with PartialFunction[Int, A] with Iterable[A] {
}
}
} else
- Predef.error("cannot create subsequence");
+ throw new IllegalArgumentException("cannot create subsequence for "+from+","+len);
/** Converts this sequence to a fresh Array */
def toArray[B >: A]: Array[B] =
diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala
index d5a8f3f2e5..4634bbdb19 100644
--- a/src/library/scala/Stream.scala
+++ b/src/library/scala/Stream.scala
@@ -24,8 +24,8 @@ object Stream {
val empty: Stream[Nothing] = new Stream[Nothing] {
override def isEmpty = true
- def head: Nothing = error("head of empty stream")
- def tail: Stream[Nothing] = error("tail of empty stream")
+ def head: Nothing = throw new java.util.NoSuchElementException("head of empty stream")
+ def tail: Stream[Nothing] = throw new java.util.NoSuchElementException("tail of empty stream")
def printElems(buf: StringBuilder, prefix: String): StringBuilder = buf
}
@@ -163,12 +163,12 @@ trait Stream[+a] extends Seq[a] {
}
def init: Stream[a] =
- if (isEmpty) error("Stream.empty.init")
+ if (isEmpty) throw new java.util.NoSuchElementException("Stream.empty.init")
else if (tail.isEmpty) Stream.empty
else Stream.cons(head, tail.init)
def last: a =
- if (isEmpty) error("Stream.empty.last")
+ if (isEmpty) throw new java.util.NoSuchElementException("Stream.empty.last")
else {
def loop(s: Stream[a]): a = {
if (s.tail.isEmpty) s.head
@@ -251,11 +251,11 @@ trait Stream[+a] extends Seq[a] {
else f(head, tail.foldRight(z)(f))
def reduceLeft[b >: a](f: (b, b) => b): b =
- if (isEmpty) error("Stream.empty.reduceLeft")
+ if (isEmpty) throw new java.util.NoSuchElementException("Stream.empty.reduceLeft")
else ((tail: Stream[b]) foldLeft (head: b))(f)
def reduceRight[b >: a](f: (b, b) => b): b =
- if (isEmpty) error("Stream.empty.reduceRight")
+ if (isEmpty) throw new java.util.NoSuchElementException("Stream.empty.reduceRight")
else if (tail.isEmpty) head: b
else f(head, tail.reduceRight(f))
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala
index bf51e021b9..8d5719f5c3 100644
--- a/src/library/scala/collection/Map.scala
+++ b/src/library/scala/collection/Map.scala
@@ -139,6 +139,6 @@ trait Map[A, +B] extends AnyRef
* @param key ...
*/
def default(key: A): B =
- error("key not found: " + key)
+ throw new java.util.NoSuchElementException("key not found: " + key)
}
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index b4a6687cc9..6ead04fdfd 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -27,6 +27,8 @@ object ListMap {
[serializable]
class ListMap[A, B] extends AnyRef with Map[A, B] {
+ import java.util.NoSuchElementException
+
/** This method returns a new ListMap instance mapping keys of the
* same type to values of type <code>C</code>.
*/
@@ -66,7 +68,7 @@ class ListMap[A, B] extends AnyRef with Map[A, B] {
var that: ListMap[A,B] = ListMap.this;
def hasNext = !that.isEmpty;
def next: Pair[A,B] =
- if (!hasNext) error("next on empty iterator")
+ if (!hasNext) throw new NoSuchElementException("next on empty iterator")
else { val res = Pair(that.key, that.value); that = that.next; res }
}
@@ -88,9 +90,9 @@ class ListMap[A, B] extends AnyRef with Map[A, B] {
override def hashCode(): Int = 0
- protected def key: A = error("empty map");
- protected def value: B = error("empty map");
- protected def next: ListMap[A, B] = error("empty map");
+ protected def key: A = throw new NoSuchElementException("empty map");
+ protected def value: B = throw new NoSuchElementException("empty map");
+ protected def next: ListMap[A, B] = throw new NoSuchElementException("empty map");
[serializable]
protected class Node(override protected val key: A, override protected val value: B)
diff --git a/src/library/scala/collection/immutable/ListSet.scala b/src/library/scala/collection/immutable/ListSet.scala
index 2924e4ef96..65d5c930ed 100644
--- a/src/library/scala/collection/immutable/ListSet.scala
+++ b/src/library/scala/collection/immutable/ListSet.scala
@@ -30,6 +30,8 @@ object ListSet {
[serializable]
class ListSet[A] extends AnyRef with Set[A] {
+ import java.util.NoSuchElementException
+
/** Returns the number of elements in this set.
*
* @return number of set elements.
@@ -58,13 +60,14 @@ class ListSet[A] extends AnyRef with Set[A] {
/** Creates a new iterator over all elements contained in this set.
*
+ * @throws java.util.NoSuchElementException
* @return the new iterator
*/
def elements: Iterator[A] = new Iterator[A] {
var that: ListSet[A] = ListSet.this;
def hasNext = !that.isEmpty;
def next: A =
- if (!hasNext) error("next on empty iterator")
+ if (!hasNext) throw new NoSuchElementException("next on empty iterator")
else { val res = that.elem; that = that.next; res }
}
@@ -78,8 +81,15 @@ class ListSet[A] extends AnyRef with Set[A] {
} else
false
- protected def elem: A = error("Set has no elelemnts");
- protected def next: ListSet[A] = error("Next of an empty set");
+ /**
+ * @throws java.util.NoSuchElementException
+ */
+ protected def elem: A = throw new NoSuchElementException("Set has no elelemnts");
+
+ /**
+ * @throws java.util.NoSuchElementException
+ */
+ protected def next: ListSet[A] = throw new NoSuchElementException("Next of an empty set");
[serializable]
protected class Node(override protected val elem: A) extends ListSet[A] {
diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala
index 8e1730c74f..27bfdd4c32 100644
--- a/src/library/scala/collection/immutable/Queue.scala
+++ b/src/library/scala/collection/immutable/Queue.scala
@@ -24,6 +24,9 @@ object Queue {
*/
[serializable]
class Queue[+A](elem: A*) extends Seq[A] {
+
+ import java.util.NoSuchElementException
+
protected val in: List[A] = Nil
protected val out: List[A] = elem.elements.toList
@@ -38,7 +41,7 @@ class Queue[+A](elem: A*) extends Seq[A] {
*
* @param n index of the element to return
* @return the element at position <code>n</code> in this queue.
- * @throws <code>java.lang.Error</code> if the queue is too short.
+ * @throws <code>java.util.NoSuchElementException</code> if the queue is too short.
*/
def apply(n: Int): A = {
val len = out.length
@@ -46,7 +49,7 @@ class Queue[+A](elem: A*) extends Seq[A] {
else {
val m = n - len
if (m < in.length) in.reverse.apply(m)
- else error("index out of range")
+ else throw new NoSuchElementException("index out of range")
}
}
@@ -94,24 +97,26 @@ class Queue[+A](elem: A*) extends Seq[A] {
/** Returns a tuple with the first element in the queue,
* and a new queue with this element removed.
*
+ * @throws NoSuchElementException
* @return the first element of the queue.
*/
def dequeue: Pair[A, Queue[A]] = {
val Pair(newOut, newIn) =
if (out.isEmpty) Pair(in.reverse, Nil)
else Pair(out, in);
- if (newOut.isEmpty) error("queue empty")
+ if (newOut.isEmpty) throw new NoSuchElementException("queue empty")
else Pair(newOut.head, mkQueue(newIn, newOut.tail))
}
/** Returns the first element in the queue, or throws an error if there
* is no element contained in the queue.
*
+ * @throws NoSuchElementException
* @return the first element.
*/
def front: A =
if (out.isEmpty) {
- if (in.isEmpty) error("queue empty") else in.last
+ if (in.isEmpty) throw new NoSuchElementException("queue empty") else in.last
} else
out.head
diff --git a/src/library/scala/collection/immutable/Stack.scala b/src/library/scala/collection/immutable/Stack.scala
index b61c3ba16a..457efada8d 100644
--- a/src/library/scala/collection/immutable/Stack.scala
+++ b/src/library/scala/collection/immutable/Stack.scala
@@ -27,6 +27,8 @@ object Stack {
[serializable]
class Stack[+A] extends Seq[A] {
+ import java.util.NoSuchElementException
+
/** Checks if this stack is empty.
*
* @return true, iff there is no element on the stack.
@@ -69,13 +71,13 @@ class Stack[+A] extends Seq[A] {
*
* @return the top element.
*/
- def top: A = error("no element on stack")
+ def top: A = throw new NoSuchElementException("no element on stack")
/** Removes the top element from the stack.
*
* @return the new stack without the former top element.
*/
- def pop: Stack[A] = error("no element on stack")
+ def pop: Stack[A] = throw new NoSuchElementException("no element on stack")
/** Returns the n-th element of this stack. The top element has index
* 0, elements below are indexed with increasing numbers.
@@ -83,7 +85,7 @@ class Stack[+A] extends Seq[A] {
* @param n the index number.
* @return the n-th element on the stack.
*/
- def apply(n: Int): A = error("no element on stack")
+ def apply(n: Int): A = throw new NoSuchElementException("no element on stack")
/** Returns an iterator over all elements on the stack. The iterator
* issues elements in the reversed order they were inserted into the
@@ -95,7 +97,7 @@ class Stack[+A] extends Seq[A] {
var that: Stack[A] = Stack.this;
def hasNext = !that.isEmpty;
def next =
- if (!hasNext) error("next on empty iterator")
+ if (!hasNext) throw new NoSuchElementException("next on empty iterator")
else { val res = that.top; that = that.pop; res }
}
diff --git a/src/library/scala/collection/immutable/Tree.scala b/src/library/scala/collection/immutable/Tree.scala
index 8e7a447df3..59284c3eb3 100644
--- a/src/library/scala/collection/immutable/Tree.scala
+++ b/src/library/scala/collection/immutable/Tree.scala
@@ -39,6 +39,8 @@
package scala.collection.immutable
+import java.util.NoSuchElementException
+
/** General Balanced Trees - highly efficient functional dictionaries.
*
* <p>An efficient implementation of Prof. Arne Andersson's General
@@ -183,7 +185,7 @@ abstract class Tree[A <% Ordered[A], B]() extends AnyRef {
iter = t.mk_iter(iter_tail)
v
case scala.Nil =>
- error("next on empty iterator")
+ throw new NoSuchElementException("next on empty iterator")
}
}
@@ -269,8 +271,8 @@ private case class GBLeaf[A <% Ordered[A],B]() extends GBTree[A,B] {
def count = Pair(1, 0)
def isDefinedAt(key: A) = false
def get(_key: A) = None
- def apply(key: A) = error("key " + key + " not found")
- def update(key: A, value: B) = error("key " + key + " not found")
+ def apply(key: A) = throw new NoSuchElementException("key " + key + " not found")
+ def update(key: A, value: B) = throw new NoSuchElementException("key " + key + " not found")
def insert(key: A, value: B, s: Int): anInsertTree = {
if (s == 0)
INode(GBNode(key, value, this, this), 1, 1)
@@ -281,8 +283,8 @@ private case class GBLeaf[A <% Ordered[A],B]() extends GBTree[A,B] {
def mk_iter(iter_tail: List[GBTree[A,B]]) = iter_tail
def merge(larger: GBTree[A,B]) = larger
def takeSmallest: Triple[A,B, GBTree[A,B]] =
- error("Take Smallest on empty tree")
- def delete(_key: A) = error("Delete on empty tree.")
+ throw new NoSuchElementException("takeSmallest on empty tree")
+ def delete(_key: A) = throw new NoSuchElementException("Delete on empty tree.")
def balance(s: int) = this
override def hashCode() = 0
}
@@ -331,7 +333,7 @@ private case class GBNode[A <% Ordered[A],B](key: A,
else if (newKey > key)
bigger.insert(newKey, newValue, s / 2).insertRight(key, value, smaller)
else
- error("Key exists: " + newKey)
+ throw new NoSuchElementException("Key exists: " + newKey)
}
def toList(acc: List[Pair[A,B]]): List[Pair[A,B]] =
diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala
index 31c7bd95c0..6e1d9e4475 100644
--- a/src/library/scala/collection/mutable/Buffer.scala
+++ b/src/library/scala/collection/mutable/Buffer.scala
@@ -199,23 +199,23 @@ trait Buffer[A] extends AnyRef
case Start => prepend(elem)
case End => append(elem)
case Index(n) => insert(n, elem)
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
case Update(Pair(l, elem)) => l match {
case Start => update(0, elem)
case End => update(length - 1, elem)
case Index(n) => update(n, elem)
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
case Remove(Pair(l, _)) => l match {
case Start => remove(0)
case End => remove(length - 1)
case Index(n) => remove(n)
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
case Reset() => clear
case s: Script[Pair[Location, A]] => s.elements foreach <<
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
/** Return a clone of this buffer.
@@ -229,7 +229,7 @@ trait Buffer[A] extends AnyRef
*
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
/** Defines the prefix of the string representation.
*/
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index e1f1ff4d72..5df2be342a 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -119,7 +119,7 @@ final class ListBuffer[A] extends Buffer[A] {
def apply(n: Int): A = try {
start(n)
} catch {
- case ex: Error => throw new IndexOutOfBoundsException(n.toString())
+ case ex: Exception => throw new IndexOutOfBoundsException(n.toString())
}
/** Replace element at index <code>n</code> with the new element
@@ -146,7 +146,7 @@ final class ListBuffer[A] extends Buffer[A] {
cursor.asInstanceOf[scala.::[A]].tl = newElem
}
} catch {
- case ex: Error => throw new IndexOutOfBoundsException(n.toString())
+ case ex: Exception => throw new IndexOutOfBoundsException(n.toString())
}
/** Inserts new elements at the index <code>n</code>. Opposed to method
@@ -181,7 +181,7 @@ final class ListBuffer[A] extends Buffer[A] {
}
}
} catch {
- case ex: Error => throw new IndexOutOfBoundsException(n.toString())
+ case ex: Exception => throw new IndexOutOfBoundsException(n.toString())
}
@@ -209,7 +209,7 @@ final class ListBuffer[A] extends Buffer[A] {
}
old
} catch {
- case ex: Error => throw new IndexOutOfBoundsException(n.toString())
+ case ex: Exception => throw new IndexOutOfBoundsException(n.toString())
}
/** Returns an iterator over all elements of this list.
@@ -222,7 +222,7 @@ final class ListBuffer[A] extends Buffer[A] {
def hasNext: Boolean = !start.isEmpty && cursor != last
def next: A =
if (!hasNext) {
- error("next on empty Iterator")
+ throw new java.util.NoSuchElementException("next on empty Iterator")
} else {
if (cursor == null) cursor = start else cursor = cursor.tail
cursor.head
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index 78555a4e20..4b0c5e6b16 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -129,7 +129,7 @@ trait Map[A, B] extends AnyRef
case Remove(Pair(k, _)) => this -= k
case Reset() => clear
case s: Script[Pair[A, B]] => s.elements foreach <<
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
/** Return a clone of this map.
@@ -143,7 +143,7 @@ trait Map[A, B] extends AnyRef
*
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
/** Returns a string representation of this map which shows
* all the mappings.
diff --git a/src/library/scala/collection/mutable/Message.scala b/src/library/scala/collection/mutable/Message.scala
index 8c59ad2334..c5eae4eac7 100644
--- a/src/library/scala/collection/mutable/Message.scala
+++ b/src/library/scala/collection/mutable/Message.scala
@@ -76,5 +76,5 @@ class Script[A] extends ArrayBuffer[Message[A]] with Message[A] {
}
override def hashCode(): Int =
- Predef.error("scripts are not suitable as hash keys")
+ throw new UnsupportedOperationException("scripts are not suitable as hash keys")
}
diff --git a/src/library/scala/collection/mutable/MutableList.scala b/src/library/scala/collection/mutable/MutableList.scala
index 69e778ab66..6e5059d4a5 100644
--- a/src/library/scala/collection/mutable/MutableList.scala
+++ b/src/library/scala/collection/mutable/MutableList.scala
@@ -32,7 +32,7 @@ trait MutableList[A] extends Seq[A] with PartialFunction[Int, A] {
* yields an error if the element does not exist.
*/
def apply(n: Int): A = get(n) match {
- case None => error("element not found")
+ case None => throw new java.util.NoSuchElementException("element not found")
case Some(value) => value
}
diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala
index 8112630da6..0ec53babd2 100644
--- a/src/library/scala/collection/mutable/ObservableBuffer.scala
+++ b/src/library/scala/collection/mutable/ObservableBuffer.scala
@@ -73,6 +73,8 @@ trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
abstract override def clear: Unit = {
super.clear
- publish(new Reset with Undoable { def undo: Unit = error("cannot undo") })
+ publish(new Reset with Undoable {
+ def undo: Unit = throw new UnsupportedOperationException("cannot undo")
+ })
}
}
diff --git a/src/library/scala/collection/mutable/ObservableMap.scala b/src/library/scala/collection/mutable/ObservableMap.scala
index da08fb95d7..f6713125d9 100644
--- a/src/library/scala/collection/mutable/ObservableMap.scala
+++ b/src/library/scala/collection/mutable/ObservableMap.scala
@@ -50,6 +50,8 @@ trait ObservableMap[A, B, This <: ObservableMap[A, B, This]] requires This
abstract override def clear: Unit = {
super.clear
- publish(new Reset with Undoable { def undo: Unit = error("cannot undo") })
+ publish(new Reset with Undoable {
+ def undo: Unit = throw new UnsupportedOperationException("cannot undo")
+ })
}
}
diff --git a/src/library/scala/collection/mutable/ObservableSet.scala b/src/library/scala/collection/mutable/ObservableSet.scala
index 52b81b24d4..f437fa8cfa 100644
--- a/src/library/scala/collection/mutable/ObservableSet.scala
+++ b/src/library/scala/collection/mutable/ObservableSet.scala
@@ -38,6 +38,8 @@ trait ObservableSet[A, This <: ObservableSet[A, This]] requires This
abstract override def clear: Unit = {
super.clear
- publish(new Reset with Undoable { def undo: Unit = error("cannot undo") })
+ publish(new Reset with Undoable {
+ def undo: Unit = throw new UnsupportedOperationException("cannot undo")
+ })
}
}
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index b6cb527d52..0c029dbe49 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -24,6 +24,8 @@ package scala.collection.mutable
class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] {
size = size + 1 // we do not use array(0)
+ import java.util.NoSuchElementException
+
protected def fixUp(as: Array[A], m: Int): Unit = {
var k: Int = m
while ((k > 1) && (as(k / 2) < as(k))) {
@@ -89,6 +91,7 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] {
/** Returns the element with the highest priority in the queue,
* and removes this element from the queue.
*
+ * @throws java.util.NoSuchElementException
* @return the element with the highest priority.
*/
def dequeue: A =
@@ -98,14 +101,14 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] {
fixDown(array, 1, size - 1)
array(size)
} else
- error("no element to remove from heap")
+ throw new NoSuchElementException("no element to remove from heap")
/** Returns the element with the highest priority in the queue,
* or throws an error if there is no element contained in the queue.
*
* @return the element with the highest priority.
*/
- def max: A = if (size > 1) array(1) else error("queue is empty")
+ def max: A = if (size > 1) array(1) else throw new NoSuchElementException("queue is empty")
/** Removes all elements from the queue. After this operation is completed,
* the queue will be empty.
@@ -147,7 +150,7 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] {
*
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
/** Returns a regular queue containing the same elements.
*/
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala
index d1a769b7eb..36fc82cf0d 100644
--- a/src/library/scala/collection/mutable/Queue.scala
+++ b/src/library/scala/collection/mutable/Queue.scala
@@ -58,11 +58,12 @@ class Queue[A] extends MutableList[A] {
/** Returns the first element in the queue, and removes this element
* from the queue.
*
+ * @throws java.util.NoSuchElementException
* @return the first element of the queue.
*/
def dequeue: A =
if (first == null)
- error("queue empty")
+ throw new java.util.NoSuchElementException("queue empty")
else {
val res = first.elem
first = first.next
@@ -170,9 +171,10 @@ class Queue[A] extends MutableList[A] {
/** The hashCode method always yields an error, since it is not
* safe to use mutable queues as keys in hash tables.
*
+ * @throws UnsupportedOperationException
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
/** Returns a textual representation of a queue as a string.
*
diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala
index 86b6268dcd..b64cd35db0 100644
--- a/src/library/scala/collection/mutable/Set.scala
+++ b/src/library/scala/collection/mutable/Set.scala
@@ -109,7 +109,7 @@ trait Set[A] extends AnyRef with collection.Set[A]
case Remove(elem) => this -= elem
case Reset() => clear
case s: Script[A] => s.elements foreach <<
- case _ => error("message " + cmd + " not understood")
+ case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
/** Return a clone of this set.
@@ -123,5 +123,5 @@ trait Set[A] extends AnyRef with collection.Set[A]
*
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
}
diff --git a/src/library/scala/collection/mutable/SingleLinkedList.scala b/src/library/scala/collection/mutable/SingleLinkedList.scala
index d25de421ef..6a889fc49e 100644
--- a/src/library/scala/collection/mutable/SingleLinkedList.scala
+++ b/src/library/scala/collection/mutable/SingleLinkedList.scala
@@ -40,7 +40,7 @@ abstract class SingleLinkedList[A, This >: Null <: SingleLinkedList[A, This]]
def apply(n: Int): A =
if (n == 0) elem
- else if (next == null) error("unknown element")
+ else if (next == null) throw new IndexOutOfBoundsException("unknown element")
else next.apply(n - 1)
def get(n: Int): Option[A] =
diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala
index c33f85d447..cc9c262f00 100644
--- a/src/library/scala/collection/mutable/Stack.scala
+++ b/src/library/scala/collection/mutable/Stack.scala
@@ -20,6 +20,8 @@ package scala.collection.mutable
[serializable, cloneable]
class Stack[A] extends MutableList[A] {
+ import java.util.NoSuchElementException
+
/** Checks if the stack is empty.
*
* @return true, iff there is no element on the stack
@@ -59,11 +61,15 @@ class Stack[A] extends MutableList[A] {
* the element from the stack. An error is signaled if there is no
* element on the stack.
*
+ * @throws java.util.NoSuchElementException
* @return the top element
*/
- def top: A = if (first == null) error("stack empty") else first.elem
+ def top: A = if (first == null) throw new NoSuchElementException("stack empty") else first.elem
/** Removes the top element from the stack.
+ *
+ * @throws java.util.NoSuchElementException
+ * @return the top element
*/
def pop: A =
if (first != null) {
@@ -72,7 +78,7 @@ class Stack[A] extends MutableList[A] {
len = len - 1;
res
} else
- error("stack empty")
+ throw new NoSuchElementException("stack empty")
/**
* Removes all elements from the stack. After this operation completed,
@@ -112,7 +118,7 @@ class Stack[A] extends MutableList[A] {
*
* @return never.
*/
- override def hashCode(): Int = error("unsuitable as hash key")
+ override def hashCode(): Int = throw new UnsupportedOperationException("unsuitable as hash key")
/** This method clones the stack.
*
diff --git a/src/library/scala/concurrent/Actor.scala b/src/library/scala/concurrent/Actor.scala
index 22278df39e..793f2492ef 100644
--- a/src/library/scala/concurrent/Actor.scala
+++ b/src/library/scala/concurrent/Actor.scala
@@ -25,11 +25,11 @@ abstract class Actor extends Thread {
def receive[a](f: PartialFunction[in.Message, a]): a =
if (Thread.currentThread() == this) in.receive(f)
- else error("receive called not on own process")
+ else throw new IllegalArgumentException("receive called not on own process")
def receiveWithin[a](msec: long)(f: PartialFunction[in.Message, a]): a =
if (Thread.currentThread() == this) in.receiveWithin(msec)(f)
- else error("receiveWithin called not on own process")
+ else throw new IllegalArgumentException("receiveWithin called not on own process")
private var pid: Pid = null
diff --git a/src/library/scala/concurrent/NameServer.scala b/src/library/scala/concurrent/NameServer.scala
index 6cdaca045c..2a08618508 100644
--- a/src/library/scala/concurrent/NameServer.scala
+++ b/src/library/scala/concurrent/NameServer.scala
@@ -24,13 +24,13 @@ object NameServer {
* @param proc ...
*/
def register(name: Symbol, proc: Process) = {
- if (names contains name) error("Name:" + name + " already registred")
+ if (names contains name) throw new IllegalArgumentException("Name:" + name + " already registred")
names += name -> proc
}
def unregister(name: Symbol) =
if (names contains name) names -= name
- else error("Name:" + name + " not registred")
+ else throw new IllegalArgumentException("Name:" + name + " not registred")
/**
* @param name ...
diff --git a/src/library/scala/concurrent/Process.scala b/src/library/scala/concurrent/Process.scala
index fce91b50b8..565a2e28d7 100644
--- a/src/library/scala/concurrent/Process.scala
+++ b/src/library/scala/concurrent/Process.scala
@@ -36,11 +36,14 @@ object Process {
def receiveWithin[a](msec: long)(f: PartialFunction[MailBox#Message, a]): a =
self.receiveWithin(msec)(f)
+ /**
+ * @throws UnsupportedOperationException
+ */
def self: Process =
if (Thread.currentThread().isInstanceOf[Process])
Thread.currentThread().asInstanceOf[Process]
else
- error("Self called outside a process")
+ throw new UnsupportedOperationException("Self called outside a process")
def exit(p: Process, reason: AnyRef) =
p.exit(reason)
diff --git a/src/library/scala/io/BytePickle.scala b/src/library/scala/io/BytePickle.scala
index ded1bbafcc..19d7b99bd5 100644
--- a/src/library/scala/io/BytePickle.scala
+++ b/src/library/scala/io/BytePickle.scala
@@ -151,7 +151,7 @@ object BytePickle {
case Ref() =>
val res2 = unat.appU(res._2) // read location
upe.get(res2._1) match { // lookup value in unpickler env
- case None => error("invalid unpickler environment"); return null
+ case None => throw new IllegalArgumentException("invalid unpickler environment"); return null
case Some(v) => return Pair(v.asInstanceOf[a], new UnPicklerState(res2._2, upe))
}
}
@@ -160,14 +160,14 @@ object BytePickle {
def ulift[t](x: t): PU[t] = new PU[t] {
def appP(a: t, state: Array[byte]): Array[byte] =
- if (x != a) { error("value to be pickled (" + a + ") != " + x); state }
+ if (x != a) { throw new IllegalArgumentException("value to be pickled (" + a + ") != " + x); state }
else state;
def appU(state: Array[byte]) = Pair(x, state);
}
def lift[t](x: t): SPU[t] = new SPU[t] {
def appP(a: t, state: PicklerState): PicklerState =
- if (x != a) { /*error("value to be pickled (" + a + ") != " + x);*/ state }
+ if (x != a) { /*throw new IllegalArgumentException("value to be pickled (" + a + ") != " + x);*/ state }
else state;
def appU(state: UnPicklerState) = Pair(x, state);
}
diff --git a/src/library/scala/io/Position.scala b/src/library/scala/io/Position.scala
index 6537e54b7b..8993e4a812 100644
--- a/src/library/scala/io/Position.scala
+++ b/src/library/scala/io/Position.scala
@@ -69,11 +69,11 @@ object Position {
final def encode(line: Int, column: Int): Int = {
var line1, column1 = 0
if (line < 0)
- error(line + " < 0")
+ throw new IllegalArgumentException(line + " < 0")
if ((line == 0) && (column != 0))
- error(line + "," + column + " not allowed")
+ throw new IllegalArgumentException(line + "," + column + " not allowed")
if (column < 0)
- error(line + "," + column + " not allowed")
+ throw new IllegalArgumentException(line + "," + column + " not allowed")
{if (line >= LINE_MASK) {
line1 = LINE_MASK
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index 6744d302a3..d6195e034b 100755
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -56,7 +56,7 @@ final class RichString(s: String) {
var index = 0
def hasNext: Boolean = index <= len
def next: String = {
- if (index >= len) Predef.error("next on empty iterator")
+ if (index >= len) throw new java.util.NoSuchElementException("next on empty iterator")
val start = index
while (index < len && !isLineBreak(apply(index))) index = index + 1
index = index + 1
diff --git a/src/library/scala/util/automata/BaseBerrySethi.scala b/src/library/scala/util/automata/BaseBerrySethi.scala
index 522e3dc903..7a7a6c642f 100644
--- a/src/library/scala/util/automata/BaseBerrySethi.scala
+++ b/src/library/scala/util/automata/BaseBerrySethi.scala
@@ -64,7 +64,7 @@ abstract class BaseBerrySethi {
tmp
case Star(t) => compFirst(t)
case _ =>
- error("unexpected pattern " + Platform.getClass(r))
+ throw new IllegalArgumentException("unexpected pattern " + Platform.getClass(r))
}
/** computes last( r ) for the regexp r */
@@ -89,7 +89,7 @@ abstract class BaseBerrySethi {
tmp
case Star(t) => compLast(t)
case _ =>
- error("unexpected pattern " + Platform.getClass(r))
+ throw new IllegalArgumentException("unexpected pattern " + Platform.getClass(r))
}
/** Starts from the right-to-left
@@ -170,7 +170,7 @@ abstract class BaseBerrySethi {
first
case _ =>
- error("unexpected pattern: " + Platform.getClass(r))
+ throw new IllegalArgumentException("unexpected pattern: " + Platform.getClass(r))
}
}
@@ -193,7 +193,7 @@ abstract class BaseBerrySethi {
case Star(t) =>
traverse(t)
case _ =>
- error("unexp pattern " + Platform.getClass(r))
+ throw new IllegalArgumentException("unexp pattern " + Platform.getClass(r))
}
}
diff --git a/src/library/scala/xml/Elem.scala b/src/library/scala/xml/Elem.scala
index 1cf463051e..96b571c505 100644
--- a/src/library/scala/xml/Elem.scala
+++ b/src/library/scala/xml/Elem.scala
@@ -29,21 +29,15 @@ case class Elem(override val prefix: String,
val child: Node*) extends Node {
if (prefix != null && 0 == prefix.length())
- scala.Predef.error("prefix of zero length, use null instead");
+ throw new IllegalArgumentException("prefix of zero length, use null instead");
if (null == scope)
- scala.Predef.error("scope is null");
+ throw new IllegalArgumentException("scope is null, try xml.TopScope for empty scope");
//@todo: copy the children,
// setting namespace scope if necessary
// cleaning adjacent text nodes if necessary
- //final val namespaceIntern = namespace$$.intern();
- //final def namespace = namespaceIntern;
-
- //final val labelIntern = label$$.intern();
- //final def label = labelIntern;
-
final override def typeTag$: Int = 0;
override def hashCode(): Int = {
diff --git a/src/library/scala/xml/Group.scala b/src/library/scala/xml/Group.scala
index 8a7cc03da2..c5f7911138 100644
--- a/src/library/scala/xml/Group.scala
+++ b/src/library/scala/xml/Group.scala
@@ -31,25 +31,35 @@ case class Group(val nodes: Seq[Node]) extends Node {
case _ => false;
}
- /** always null */
+ /**
+ * @throws UnsupportedOperationException (always)
+ */
final def label =
- error("class Group does not support method 'label'")
+ throw new UnsupportedOperationException("class Group does not support method 'label'")
- /** always empty */
+ /**
+ * @throws UnsupportedOperationException (always)
+ */
final override def attributes =
- error("class Group does not support method 'attributes'")
+ throw new UnsupportedOperationException("class Group does not support method 'attributes'")
- /** always null */
+ /**
+ * @throws UnsupportedOperationException (always)
+ */
final override def namespace =
- error("class Group does not support method 'namespace'")
+ throw new UnsupportedOperationException("class Group does not support method 'namespace'")
- /** always empty */
+ /**
+ * @throws UnsupportedOperationException (always)
+ */
final override def child =
- error("class Group does not support method 'child'")
+ throw new UnsupportedOperationException("class Group does not support method 'child'")
- /** returns text, with some characters escaped according to XML spec */
+ /**
+ * @throws UnsupportedOperationException (always)
+ */
def toString(sb: StringBuilder) =
- error("class Group does not support method toString(StringBuilder)")
+ throw new UnsupportedOperationException("class Group does not support method toString(StringBuilder)")
override def text = { // same impl as NodeSeq
val sb = new StringBuilder()
diff --git a/src/library/scala/xml/NamespaceBinding.scala b/src/library/scala/xml/NamespaceBinding.scala
index 7ad05dfcc5..cccfa893c1 100644
--- a/src/library/scala/xml/NamespaceBinding.scala
+++ b/src/library/scala/xml/NamespaceBinding.scala
@@ -29,7 +29,7 @@ class NamespaceBinding(val prefix: String,
private val serialVersionUID = 0 - 2518644165573446725L
if (null != prefix && 0 == prefix.length())
- Predef.error("zero length prefix not allowed")
+ throw new IllegalArgumentException("zero length prefix not allowed")
def getURI(_prefix: String): String =
if (prefix == _prefix) uri else parent.getURI(_prefix)
diff --git a/src/library/scala/xml/dtd/Decl.scala b/src/library/scala/xml/dtd/Decl.scala
index eaa545b98b..862c48fa90 100644
--- a/src/library/scala/xml/dtd/Decl.scala
+++ b/src/library/scala/xml/dtd/Decl.scala
@@ -120,7 +120,7 @@ case class IntDef(value:String) extends EntityDef {
while( ix != -1) {
val iz = tmp.indexOf(';', ix);
if(iz == -1 && iz == ix + 1)
- error("no % allowed in entity value, except for parameter-entity-references");
+ throw new IllegalArgumentException("no % allowed in entity value, except for parameter-entity-references");
else {
val n = tmp.substring(ix, iz);
diff --git a/src/library/scala/xml/parsing/MarkupParser.scala b/src/library/scala/xml/parsing/MarkupParser.scala
index b78a3d0969..c3a69b555a 100644
--- a/src/library/scala/xml/parsing/MarkupParser.scala
+++ b/src/library/scala/xml/parsing/MarkupParser.scala
@@ -1098,8 +1098,10 @@ trait MarkupParser requires (MarkupParser with MarkupHandler) extends AnyRef wit
else
null;
new PublicID(pubID, sysID);
- } else
- error("PUBLIC or SYSTEM expected");
+ } else {
+ reportSyntaxError("PUBLIC or SYSTEM expected");
+ error("died parsing notationdecl")
+ }
xSpaceOpt
xToken('>')
handle.notationDecl(notat, extID)
diff --git a/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala b/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala
index 8c1d0a5767..a233cc527c 100644
--- a/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala
+++ b/src/library/scala/xml/parsing/ValidatingMarkupHandler.scala
@@ -36,7 +36,7 @@ abstract class ValidatingMarkupHandler extends MarkupHandler with Logged {
val res = decl.contentModel.validate(ns);
Console.println("res = "+res);
if(!res)
- error("invalid!");
+ //error("invalid!");
}
*/
diff --git a/src/library/scala/xml/transform/BasicTransformer.scala b/src/library/scala/xml/transform/BasicTransformer.scala
index ca9cd70a9d..4d3bfbe252 100644
--- a/src/library/scala/xml/transform/BasicTransformer.scala
+++ b/src/library/scala/xml/transform/BasicTransformer.scala
@@ -104,7 +104,7 @@ abstract class BasicTransformer extends Function1[Node,Node] {
def apply(n: Node): Node = {
val seq = transform(n)
if (!single(seq))
- error("transform must return single node for root");
+ throw new UnsupportedOperationException("transform must return single node for root");
else seq.elements.next
}
}