Git Product home page Git Product logo

Comments (4)

ScalaWilliamD avatar ScalaWilliamD commented on July 17, 2024

Also

er.close()
src.close()

gives

Exception in thread "XMLEventReader" java.io.IOException: Stream Closed
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:272)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.BufferedReader.fill(BufferedReader.java:154)
    at java.io.BufferedReader.read(BufferedReader.java:175)
    at scala.io.BufferedSource$$anonfun$iter$1$$anonfun$apply$mcI$sp$1.apply$mcI$sp(BufferedSource.scala:38)
    at scala.io.Codec.wrap(Codec.scala:68)
    at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
    at scala.io.BufferedSource$$anonfun$iter$1.apply(BufferedSource.scala:38)
    at scala.collection.Iterator$$anon$9.next(Iterator.scala:162)
    at scala.collection.Iterator$$anon$17.hasNext(Iterator.scala:511)
    at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
    at scala.io.Source.hasNext(Source.scala:226)
    at scala.xml.parsing.MarkupParser$class.ch(MarkupParser.scala:104)
    at scala.xml.pull.XMLEventReader$Parser.ch(XMLEventReader.scala:59)
    at scala.xml.parsing.MarkupParserCommon$class.xName(MarkupParserCommon.scala:116)
    at scala.xml.pull.XMLEventReader$Parser.xName(XMLEventReader.scala:59)

it does continue reading without stopping.

from scala-xml.

fancellu avatar fancellu commented on July 17, 2024

Knocked out a quick version with StaX, works fine on 4GB file.

https://gist.github.com/fancellu/745bb780adf938c39395

from scala-xml.

ashawley avatar ashawley commented on July 17, 2024

I'm not able to verify this problem in a unit test. Nothing has changed in the XMLEventReader since, and maybe something changed in Java, Scala or the standard library, but probably not much. This test uses an infinite character stream as the source.

  @Test
  def largeSourceTest = {
    val src = new Source {
      val str = "<x><y z=''/>9</x>\n"
      lazy val elChars: Stream[Char] = str.toList.toStream #::: elChars
      protected val iter = elChars.toIterator
    }
    val reader = new XMLEventReader(src)
    reader.take(100)
    reader.stop
    src.close
  }

I even tried running it against a source of an actual 1G file , but I couldn't reproduce the issue.

from scala-xml.

ashawley avatar ashawley commented on July 17, 2024

Closing as can't reproduce. If this is still an issue, we'll just need an example.

from scala-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.