Repository: incubator-gearpump
Updated Branches:
  refs/heads/master eaf5b6cb2 -> 2783559db


Gearpump 257 remote application submit

https://issues.apache.org/jira/browse/GEARPUMP-257
 `[GEARPUMP-Gearpump 257] Client context should throw an exception when client 
tries to submit an application with jar file that does not exist.
 Previously it used to upload an empty stream and master used to fail with file 
not found exception.

Author: [email protected] <[email protected]>

Closes #126 from th3iedkid/GEARPUMP-257_Remote_application_submit_.


Project: http://git-wip-us.apache.org/repos/asf/incubator-gearpump/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-gearpump/commit/2783559d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gearpump/tree/2783559d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gearpump/diff/2783559d

Branch: refs/heads/master
Commit: 2783559dbf1fe0dd5f090cece152bef65251d5b8
Parents: eaf5b6c
Author: [email protected] <[email protected]>
Authored: Thu Dec 29 06:26:29 2016 +0800
Committer: manuzhang <[email protected]>
Committed: Thu Dec 29 06:26:29 2016 +0800

----------------------------------------------------------------------
 .../gearpump/cluster/client/ClientContext.scala   | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-gearpump/blob/2783559d/core/src/main/scala/org/apache/gearpump/cluster/client/ClientContext.scala
----------------------------------------------------------------------
diff --git 
a/core/src/main/scala/org/apache/gearpump/cluster/client/ClientContext.scala 
b/core/src/main/scala/org/apache/gearpump/cluster/client/ClientContext.scala
old mode 100644
new mode 100755
index 0cba079..34582dd
--- a/core/src/main/scala/org/apache/gearpump/cluster/client/ClientContext.scala
+++ b/core/src/main/scala/org/apache/gearpump/cluster/client/ClientContext.scala
@@ -19,23 +19,23 @@
 package org.apache.gearpump.cluster.client
 
 import java.util.concurrent.TimeUnit
-import scala.collection.JavaConverters._
-import scala.concurrent.duration.Duration
-import scala.concurrent.{Await, Future}
-import scala.util.Try
 
 import akka.actor.{ActorRef, ActorSystem}
 import akka.util.Timeout
 import com.typesafe.config.{Config, ConfigValueFactory}
-import org.slf4j.Logger
-
 import org.apache.gearpump.cluster.MasterToAppMaster.{AppMastersData, 
ReplayFromTimestampWindowTrailingEdge}
 import org.apache.gearpump.cluster.MasterToClient.ReplayApplicationResult
 import org.apache.gearpump.cluster._
 import org.apache.gearpump.cluster.master.MasterProxy
-import org.apache.gearpump.jarstore.{JarStoreClient, JarStoreServer}
+import org.apache.gearpump.jarstore.JarStoreClient
 import org.apache.gearpump.util.Constants._
 import org.apache.gearpump.util.{ActorUtil, Constants, LogUtil, Util}
+import org.slf4j.Logger
+
+import scala.collection.JavaConverters._
+import scala.concurrent.duration.Duration
+import scala.concurrent.{Await, Future}
+import scala.util.Try
 
 /**
  * ClientContext is a user facing util to submit/manage an application.
@@ -139,6 +139,10 @@ class ClientContext(config: Config, sys: ActorSystem, 
_master: ActorRef) {
 
   private def loadFile(jarPath: String): AppJar = {
     val jarFile = new java.io.File(jarPath)
+    if (!jarFile.exists()) {
+      val error = s"File $jarPath does not exist and cannot submit application"
+      throw new Exception(error)
+    }
     Util.uploadJar(jarFile, jarStoreClient)
   }
 

Reply via email to