Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

S4-66 Check for indirect extension of s4.App

In case of failure throw exception instead of stopping the process
  • Loading branch information...
commit 858a8aff138f296297982fda482ead357e86a018 1 parent dd1da04
Daniel Gómez Ferro authored
View
4 subprojects/s4-tools/src/main/java/org/apache/s4/tools/Package.java
@@ -42,11 +42,11 @@ public static void main(String[] args) {
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")
View
8 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")
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.