incubator-s4-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dfe...@apache.org
Subject [2/2] git commit: S4-66 Check for indirect extension of s4.App
Date Thu, 07 Mar 2013 17:31:42 GMT
Updated Branches:
  refs/heads/S4-66 60a75a078 -> 858a8aff1


S4-66 Check for indirect extension of s4.App

In case of failure throw exception instead of stopping the process


Project: http://git-wip-us.apache.org/repos/asf/incubator-s4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-s4/commit/858a8aff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-s4/tree/858a8aff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-s4/diff/858a8aff

Branch: refs/heads/S4-66
Commit: 858a8aff138f296297982fda482ead357e86a018
Parents: dd1da04
Author: Daniel Gómez Ferro <dferro@apache.org>
Authored: Thu Mar 7 18:15:41 2013 +0100
Committer: Daniel Gómez Ferro <dferro@apache.org>
Committed: Thu Mar 7 18:20:04 2013 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/s4/tools/Package.java |    4 ++--
 .../src/main/resources/templates/build.gradle      |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/858a8aff/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java
----------------------------------------------------------------------
diff --git a/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java b/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java
index 0a05ac7..0c98abc 100644
--- a/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java
+++ b/subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java
@@ -42,11 +42,11 @@ public class Package extends S4ArgsBase {
             params.add("appName=" + packageArgs.appName.get(0));
             ExecGradle.exec(packageArgs.gradleBuildFile, "installS4R", params.toArray(new
String[] {}));
 
-            // Explicitly shutdown the JVM since Gradle leaves non-daemon threads running
that delay the termination
-            System.exit(0);
         } catch (Exception e) {
             LoggerFactory.getLogger(Package.class).error("Cannot deploy app", e);
         }
+        // Explicitly shutdown the JVM since Gradle leaves non-daemon threads running that
delay the termination
+        System.exit(0);
     }
 
     @Parameters(commandNames = "package", separators = "=", commandDescription = "Create
s4r")

http://git-wip-us.apache.org/repos/asf/incubator-s4/blob/858a8aff/subprojects/s4-tools/src/main/resources/templates/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/s4-tools/src/main/resources/templates/build.gradle b/subprojects/s4-tools/src/main/resources/templates/build.gradle
index 2651642..9a853b4 100644
--- a/subprojects/s4-tools/src/main/resources/templates/build.gradle
+++ b/subprojects/s4-tools/src/main/resources/templates/build.gradle
@@ -151,11 +151,11 @@ void checkAppClass() {
    def appJar = project.libsDir.path+"/app/"+"$project.name"+".jar"
    loader.addURL(new URL("file://"+appJar))
 
-   def instance = Class.forName(appClassName, true, this.getClass().getClassLoader()).newInstance()
+   def userClass = Class.forName(appClassName, true, this.getClass().getClassLoader())
+   def appClass = Class.forName('org.apache.s4.core.App', true, this.getClass().getClassLoader())
 
-   if (!(instance.getClass().getSuperclass().getName() == 'org.apache.s4.core.App') ){
-      println "App class " + appClassName + " does not extend org.apache.s4.core.App!"
-      System.exit(1)
+   if (!(appClass.isAssignableFrom(userClass))){
+      throw new InvalidUserDataException("App class " + appClassName + " does not extend
org.apache.s4.core.App")
    }
 
 }


Mime
View raw message