Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ qbin
# Mac specific, but that is common enough a dev platform to warrant inclusion.
.DS_Store

target/
target/

# for temporary generated vi lock files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should go in your local git excludes file, as it's specific to your setup, not this project

.*.swp

5 changes: 4 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.1")
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.1")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in your local ~/.sbt/0.13/plugins.sbt as it's not required for the build. Adding plugins adds dependencies and makes automation / version upgrades trickier.


26 changes: 19 additions & 7 deletions src/main/scala/scala/xml/pull/XMLEventReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,20 @@ class XMLEventReader(src: Source)
def text(pos: Int, txt: String) = setEvent(EvText(txt))

override def run() {
curInput = input
interruptibly { this.initialize.document() }
setEvent(POISON)
try {
curInput = input
interruptibly {
this.initialize.document()
}
setEvent(POISON)
} catch {
case e: Throwable => setEvent(new EvError(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably only catch case NonFatal(e)? If Throwable is needed, it should be documented so it doesn't get reverted.

}
}
}
}

case class EvError(e: Throwable) extends XMLEvent
// An iterator designed for one or more producers to generate
// elements, and a single consumer to iterate. Iteration will continue
// until closeIterator() is called, after which point producers
Expand Down Expand Up @@ -138,11 +145,16 @@ trait ProducerConsumerIterator[T >: Null] extends Iterator[T] {

// consumer/iterator interface - we need not synchronize access to buffer
// because we required there to be only one consumer.
def hasNext = !eos && (buffer != null || fillBuffer)

def hasNext() = {
if (buffer.isInstanceOf[EvError])
throw buffer.asInstanceOf[EvError].e
!eos && (buffer != null || fillBuffer)
}
def next() = {
if (eos()) throw new NoSuchElementException("ProducerConsumerIterator")
if (buffer == null) fillBuffer()
if (eos) throw new NoSuchElementException("ProducerConsumerIterator")
if (buffer.isInstanceOf[EvError])
throw buffer.asInstanceOf[EvError].e
if (buffer == null) fillBuffer

drainBuffer()
}
Expand Down