Repository: zeppelin Updated Branches: refs/heads/master 08c9ad9a6 -> 008fa369f
ZEPPELIN-3156. Fixed Checkstyle errors and warnings in groovy module ### What is this PR for? Fixed the Checkstyle errors and warnings in the groovy module. ### What type of PR is it? Improvement ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3156 ### How should this be tested? * CI pass ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: Jan Hentschel <jan.hentsc...@ultratendency.com> Closes #2798 from HorizonNet/ZEPPELIN-3156 and squashes the following commits: 445ec95 [Jan Hentschel] ZEPPELIN-3156. Fixed Checkstyle errors and warnings in groovy module Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/008fa369 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/008fa369 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/008fa369 Branch: refs/heads/master Commit: 008fa369f37534096f59598f8b5374bcf56924e5 Parents: 08c9ad9 Author: Jan Hentschel <jan.hentsc...@ultratendency.com> Authored: Tue Feb 13 14:01:47 2018 +0100 Committer: Jeff Zhang <zjf...@apache.org> Committed: Wed Apr 11 09:11:50 2018 +0800 ---------------------------------------------------------------------- groovy/pom.xml | 7 ++++ .../org/apache/zeppelin/groovy/GObject.java | 38 ++++++++------------ .../zeppelin/groovy/GroovyInterpreter.java | 38 +++++++++++--------- 3 files changed, 43 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/008fa369/groovy/pom.xml ---------------------------------------------------------------------- diff --git a/groovy/pom.xml b/groovy/pom.xml index 8de3365..9b95fc3 100644 --- a/groovy/pom.xml +++ b/groovy/pom.xml @@ -80,6 +80,13 @@ <plugin> <artifactId>maven-resources-plugin</artifactId> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <configuration> + <skip>false</skip> + </configuration> + </plugin> </plugins> </build> http://git-wip-us.apache.org/repos/asf/zeppelin/blob/008fa369/groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java ---------------------------------------------------------------------- diff --git a/groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java b/groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java index babda8f..9948b89 100644 --- a/groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java +++ b/groovy/src/main/java/org/apache/zeppelin/groovy/GObject.java @@ -16,43 +16,37 @@ */ package org.apache.zeppelin.groovy; - -import java.io.StringWriter; - import org.slf4j.Logger; -import java.util.Properties; +import java.io.StringWriter; import java.util.Collection; -import java.util.Map; -import java.util.List; import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; -import groovy.xml.MarkupBuilder; import groovy.lang.Closure; +import groovy.xml.MarkupBuilder; -import org.apache.zeppelin.interpreter.InterpreterContext; -import org.apache.zeppelin.interpreter.InterpreterContextRunner; - -import org.apache.zeppelin.display.AngularObjectRegistry; +import org.apache.zeppelin.annotation.ZeppelinApi; import org.apache.zeppelin.display.AngularObject; +import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; import org.apache.zeppelin.display.ui.OptionInput.ParamOption; -import org.apache.zeppelin.annotation.ZeppelinApi; +import org.apache.zeppelin.interpreter.InterpreterContext; +import org.apache.zeppelin.interpreter.InterpreterContextRunner; import org.apache.zeppelin.interpreter.RemoteWorksController; -import org.apache.zeppelin.interpreter.InterpreterException; /** * Groovy interpreter for Zeppelin. */ public class GObject extends groovy.lang.GroovyObjectSupport { - Logger log; StringWriter out; Properties props; InterpreterContext interpreterContext; Map<String, Object> bindings; - public GObject(Logger log, StringWriter out, Properties p, InterpreterContext ctx, Map<String, Object> bindings) { this.log = log; @@ -90,7 +84,7 @@ public class GObject extends groovy.lang.GroovyObjectSupport { } /** - * returns gui object + * returns gui object. */ public GUI getGui() { return interpreterContext.getGui(); @@ -182,9 +176,9 @@ public class GObject extends groovy.lang.GroovyObjectSupport { } /** - * starts or continues rendering table rows + * starts or continues rendering table rows. * - * @param obj: 1. List(rows) of List(columns) where first line is a header + * @param obj List(rows) of List(columns) where first line is a header */ public void table(Object obj) { if (obj == null) { @@ -294,7 +288,7 @@ public class GObject extends groovy.lang.GroovyObjectSupport { } /** - * Run paragraph by id + * Run paragraph by id. */ @ZeppelinApi public void run(String noteId, String paragraphId) { @@ -302,7 +296,7 @@ public class GObject extends groovy.lang.GroovyObjectSupport { } /** - * Run paragraph by id + * Run paragraph by id. */ @ZeppelinApi public void run(String paragraphId) { @@ -311,7 +305,7 @@ public class GObject extends groovy.lang.GroovyObjectSupport { } /** - * Run paragraph by id + * Run paragraph by id. */ @ZeppelinApi public void run(String noteId, String paragraphId, InterpreterContext context) { @@ -364,6 +358,4 @@ public class GObject extends groovy.lang.GroovyObjectSupport { public void runAll(InterpreterContext context) { runNote(context.getNoteId()); } - - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/008fa369/groovy/src/main/java/org/apache/zeppelin/groovy/GroovyInterpreter.java ---------------------------------------------------------------------- diff --git a/groovy/src/main/java/org/apache/zeppelin/groovy/GroovyInterpreter.java b/groovy/src/main/java/org/apache/zeppelin/groovy/GroovyInterpreter.java index 01e97e6..607a6d5 100644 --- a/groovy/src/main/java/org/apache/zeppelin/groovy/GroovyInterpreter.java +++ b/groovy/src/main/java/org/apache/zeppelin/groovy/GroovyInterpreter.java @@ -17,10 +17,27 @@ package org.apache.zeppelin.groovy; -import java.io.StringWriter; -import java.io.PrintWriter; +import org.codehaus.groovy.control.CompilerConfiguration; +import org.codehaus.groovy.runtime.StackTraceUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.File; -import java.util.*; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.WeakHashMap; +import java.util.concurrent.ConcurrentHashMap; + +import groovy.lang.GroovyShell; +import groovy.lang.Script; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; @@ -30,21 +47,11 @@ import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.scheduler.Job; import org.apache.zeppelin.scheduler.Scheduler; import org.apache.zeppelin.scheduler.SchedulerFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import groovy.lang.GroovyShell; -import groovy.lang.Script; -import org.codehaus.groovy.control.CompilerConfiguration; -import org.codehaus.groovy.runtime.StackTraceUtils; - -import java.util.concurrent.ConcurrentHashMap; /** * Groovy interpreter for Zeppelin. */ public class GroovyInterpreter extends Interpreter { - Logger log = LoggerFactory.getLogger(GroovyInterpreter.class); GroovyShell shell = null; //new GroovyShell(); //here we will store Interpreters shared variables. concurrent just in case. @@ -53,7 +60,6 @@ public class GroovyInterpreter extends Interpreter { Map<String, Class<Script>> scriptCache = Collections .synchronizedMap(new WeakHashMap<String, Class<Script>>(100)); - public GroovyInterpreter(Properties property) { super(property); } @@ -71,6 +77,7 @@ public class GroovyInterpreter extends Interpreter { .getPath()); classes = new File(jar.getParentFile(), "classes").toString(); } catch (Exception e) { + log.error(e.getMessage()); } } log.info("groovy classes classpath: " + classes); @@ -187,7 +194,6 @@ public class GroovyInterpreter extends Interpreter { } } - @Override public void cancel(InterpreterContext context) { Job runningJob = getRunningJob(context.getParagraphId()); @@ -206,6 +212,4 @@ public class GroovyInterpreter extends Interpreter { } } } - - }