You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2018/02/07 09:00:14 UTC
zeppelin git commit: ZEPPELIN-3145. Fixed Checkstyle errors and
warnings in the shell module
Repository: zeppelin
Updated Branches:
refs/heads/master cb174ffc6 -> c6b73beae
ZEPPELIN-3145. Fixed Checkstyle errors and warnings in the shell module
### What is this PR for?
Fixed all Checkstyle errors and warnings in the **shell** module.
### What type of PR is it?
Improvement
### Todos
* [ ] - Task
### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-3145
### 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 <ja...@ultratendency.com>
Closes #2767 from HorizonNet/ZEPPELIN-3145 and squashes the following commits:
206ffd0 [Jan Hentschel] ZEPPELIN-3145. Fixed Checkstyle errors and warnings in the shell module
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/c6b73bea
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/c6b73bea
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/c6b73bea
Branch: refs/heads/master
Commit: c6b73beae71f79b48d834dc751182ec45d244d69
Parents: cb174ff
Author: Jan Hentschel <ja...@ultratendency.com>
Authored: Mon Feb 5 23:10:23 2018 +0100
Committer: Jeff Zhang <zj...@apache.org>
Committed: Wed Feb 7 17:00:08 2018 +0800
----------------------------------------------------------------------
shell/pom.xml | 7 +++++
.../apache/zeppelin/shell/ShellInterpreter.java | 31 ++++++++++----------
.../zeppelin/shell/ShellInterpreterTest.java | 7 +++--
3 files changed, 27 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/c6b73bea/shell/pom.xml
----------------------------------------------------------------------
diff --git a/shell/pom.xml b/shell/pom.xml
index 6a7fda9..9f51dcc 100644
--- a/shell/pom.xml
+++ b/shell/pom.xml
@@ -88,6 +88,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/c6b73bea/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java
index 9707205..9f6b11d 100644
--- a/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java
+++ b/shell/src/main/java/org/apache/zeppelin/shell/ShellInterpreter.java
@@ -17,30 +17,31 @@
package org.apache.zeppelin.shell;
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
+import org.apache.commons.exec.ExecuteWatchdog;
+import org.apache.commons.exec.PumpStreamHandler;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.ByteArrayOutputStream;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.File;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.ExecuteException;
-import org.apache.commons.exec.ExecuteWatchdog;
-import org.apache.commons.exec.PumpStreamHandler;
-import org.apache.commons.lang3.StringUtils;
import org.apache.zeppelin.interpreter.InterpreterContext;
import org.apache.zeppelin.interpreter.InterpreterException;
-import org.apache.zeppelin.interpreter.KerberosInterpreter;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
+import org.apache.zeppelin.interpreter.KerberosInterpreter;
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
import org.apache.zeppelin.scheduler.Scheduler;
import org.apache.zeppelin.scheduler.SchedulerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Shell interpreter for Zeppelin.
@@ -49,7 +50,7 @@ public class ShellInterpreter extends KerberosInterpreter {
private static final Logger LOGGER = LoggerFactory.getLogger(ShellInterpreter.class);
private static final String TIMEOUT_PROPERTY = "shell.command.timeout.millisecs";
- private String DEFAULT_TIMEOUT_PROPERTY = "60000";
+ private String defaultTimeoutProperty = "60000";
private static final String DIRECTORY_USER_HOME = "shell.working.directory.user.home";
private final boolean isWindows = System.getProperty("os.name").startsWith("Windows");
@@ -100,10 +101,10 @@ public class ShellInterpreter extends KerberosInterpreter {
try {
DefaultExecutor executor = new DefaultExecutor();
executor.setStreamHandler(new PumpStreamHandler(
- contextInterpreter.out, contextInterpreter.out));
+ contextInterpreter.out, contextInterpreter.out));
executor.setWatchdog(new ExecuteWatchdog(
- Long.valueOf(getProperty(TIMEOUT_PROPERTY, DEFAULT_TIMEOUT_PROPERTY))));
+ Long.valueOf(getProperty(TIMEOUT_PROPERTY, defaultTimeoutProperty))));
executors.put(contextInterpreter.getParagraphId(), executor);
if (Boolean.valueOf(getProperty(DIRECTORY_USER_HOME))) {
executor.setWorkingDirectory(new File(System.getProperty("user.home")));
@@ -111,7 +112,7 @@ public class ShellInterpreter extends KerberosInterpreter {
int exitVal = executor.execute(cmdLine);
LOGGER.info("Paragraph " + contextInterpreter.getParagraphId()
- + " return with exit value: " + exitVal);
+ + " return with exit value: " + exitVal);
return new InterpreterResult(Code.SUCCESS, outStream.toString());
} catch (ExecuteException e) {
int exitValue = e.getExitValue();
@@ -122,7 +123,7 @@ public class ShellInterpreter extends KerberosInterpreter {
code = Code.INCOMPLETE;
message += "Paragraph received a SIGTERM\n";
LOGGER.info("The paragraph " + contextInterpreter.getParagraphId()
- + " stopped executing: " + message);
+ + " stopped executing: " + message);
}
message += "ExitValue: " + exitValue;
return new InterpreterResult(code, message);
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/c6b73bea/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
----------------------------------------------------------------------
diff --git a/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java b/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
index b67170c..1b76346 100644
--- a/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
+++ b/shell/src/test/java/org/apache/zeppelin/shell/ShellInterpreterTest.java
@@ -20,14 +20,15 @@ package org.apache.zeppelin.shell;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
import java.util.Properties;
import org.apache.zeppelin.interpreter.InterpreterContext;
import org.apache.zeppelin.interpreter.InterpreterResult;
import org.apache.zeppelin.interpreter.InterpreterResult.Code;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
public class ShellInterpreterTest {