Hi Drew, the Future you are looking at is from the Sink, which has not failed: it has successfully written zero bytes to the output file. The Source on the other hand has failed and should give you the right exception when you look at it:
val (sourceFuture, sinkFuture) = source.toMat(sink)(Keep.both).run() Upon successful completion of the stream both futures should have the same Long number. Regards, Roland > 25 sep 2015 kl. 03:59 skrev Drew Kutcharian <[email protected]>: > > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. Dr. Roland Kuhn Akka Tech Lead Typesafe – Reactive apps on the JVM. twitter: @rolandkuhn -- >>>>>>>>>> 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
