Hi Guys,

In the following simple file copy code:

object TestStreams extends App {

        implicit val system = ActorSystem("akka-stream")
        implicit val materializer = ActorMaterializer()

        val source = SynchronousFileSource(new 
File(“/path/to/non/existing/file"))

        val sink =      SynchronousFileSink(new File(“/some/other/path"))

        val futureResult = source.runWith(sink)

        val result = Await.result(f, Duration.Inf)
        println(result)

        system.shutdown()
}

Why is the “futureResult” equal to Success(0) while the stream has certainly 
failed and the following exception has been logged?

[ERROR] [09/24/2015 18:54:49.634] 
[akka-stream-akka.stream.default-file-io-dispatcher-7] 
[akka://akka-stream/user/$a/flow-1-1-synchronousFileSink] Tearing down 
SynchronousFileSink(/some/other/path) due to upstream error
java.io.FileNotFoundException: /path/to/non/existing/file (No such file or 
directory)
        at java.io.RandomAccessFile.open0(Native Method)
        at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
        at 
akka.stream.impl.io.SynchronousFilePublisher.preStart(SynchronousFilePublisher.scala:49)
        at akka.actor.Actor$class.aroundPreStart(Actor.scala:472)
        at 
akka.stream.impl.io.SynchronousFilePublisher.akka$stream$actor$ActorPublisher$$super$aroundPreStart(SynchronousFilePublisher.scala:33)
        at 
akka.stream.actor.ActorPublisher$class.aroundPreStart(ActorPublisher.scala:322)
        at 
akka.stream.impl.io.SynchronousFilePublisher.aroundPreStart(SynchronousFilePublisher.scala:33)
        at akka.actor.ActorCell.create(ActorCell.scala:580)
        at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:456)
        at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478)
        at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263)
        at akka.dispatch.Mailbox.run(Mailbox.scala:219)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

 
Thanks,

Drew

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to