Issue #1: DummyGameLocator#gameLibraries() returns a closed Stream
As Stream is AutoCloseable, the stream returned by DummyGameLocator's gameLibraries() method was getting closed immediately after the try-catch block. This resulted in the following error:
[11:00:03] [main/INFO]: Preparing the game...
Exception in thread "main" java.lang.IllegalStateException
at java.base/java.nio.file.FileTreeIterator.hasNext(FileTreeIterator.java:102)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at space.vectrix.ignite.IgniteBootstrap.run(IgniteBootstrap.java:157)
at space.vectrix.ignite.IgniteBootstrap.main(IgniteBootstrap.java:74)
.endsWith() on Path has some interesting semantics, and doesn't just match a suffix on the file name like we're expecting it to. Changing to .toString().endsWith() fixes this.
Issue #1:
DummyGameLocator#gameLibraries()
returns a closedStream
As
Stream
isAutoCloseable
, the stream returned byDummyGameLocator
'sgameLibraries()
method was getting closed immediately after the try-catch block. This resulted in the following error:This
IllegalStateException
is being thrown here: https://github.com/JetBrains/jdk8u_jdk/blob/master/src/share/classes/java/nio/file/FileTreeIterator.java#L102-L103, as the stream is already closed.Issue #2: Incorrect
.jar
extension check.endsWith()
onPath
has some interesting semantics, and doesn't just match a suffix on the file name like we're expecting it to. Changing to.toString().endsWith()
fixes this.