You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2016/02/20 17:49:38 UTC
incubator-zeppelin git commit: Return empty file list instead of
throwing error when dependency artifact is empty
Repository: incubator-zeppelin
Updated Branches:
refs/heads/master 9a610a7a2 -> 719134437
Return empty file list instead of throwing error when dependency artifact is empty
### What is this PR for?
This PR returns empty list of dependency files instead of throwing error when dependency artifact input form in interpreter setting is empty.
### What type of PR is it?
Bug Fix
### Is there a relevant Jira issue?
No. The bug is reported through comment in #673
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Mina Lee <mi...@nflabs.com>
Closes #716 from minahlee/fix/emptyArtifact and squashes the following commits:
22d5344 [Mina Lee] Return empty file list instead of throwing error when dependency artifact is empty
Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/71913443
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/71913443
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/71913443
Branch: refs/heads/master
Commit: 7191344371109284833585cb8b44609e420358a2
Parents: 9a610a7
Author: Mina Lee <mi...@nflabs.com>
Authored: Mon Feb 15 14:13:41 2016 +0900
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Feb 20 08:53:06 2016 -0800
----------------------------------------------------------------------
.../apache/zeppelin/dep/DependencyResolver.java | 40 +++++++++++---------
1 file changed, 22 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/71913443/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/DependencyResolver.java
----------------------------------------------------------------------
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/DependencyResolver.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/DependencyResolver.java
index 21e1cbb..60ef1f9 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/DependencyResolver.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/dep/DependencyResolver.java
@@ -71,8 +71,8 @@ public class DependencyResolver extends AbstractDependencyResolver {
public synchronized List<File> load(String artifact, Collection<String> excludes)
throws RepositoryException, IOException {
if (StringUtils.isBlank(artifact)) {
- // Should throw here
- throw new RuntimeException("Invalid artifact to load");
+ // Skip dependency loading if artifact is empty
+ return new LinkedList<File>();
}
// <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
@@ -88,22 +88,26 @@ public class DependencyResolver extends AbstractDependencyResolver {
public List<File> load(String artifact, Collection<String> excludes, String destPath)
throws RepositoryException, IOException {
- List<File> libs = load(artifact, excludes);
-
- // find home dir
- String home = System.getenv("ZEPPELIN_HOME");
- if (home == null) {
- home = System.getProperty("zeppelin.home");
- }
- if (home == null) {
- home = "..";
- }
-
- for (File srcFile: libs) {
- File destFile = new File(home + "/" + destPath, srcFile.getName());
- if (!destFile.exists() || !FileUtils.contentEquals(srcFile, destFile)) {
- FileUtils.copyFile(srcFile, destFile);
- logger.info("copy {} to {}", srcFile.getAbsolutePath(), destPath);
+ List<File> libs = new LinkedList<File>();
+
+ if (StringUtils.isNotBlank(artifact)) {
+ libs = load(artifact, excludes);
+
+ // find home dir
+ String home = System.getenv("ZEPPELIN_HOME");
+ if (home == null) {
+ home = System.getProperty("zeppelin.home");
+ }
+ if (home == null) {
+ home = "..";
+ }
+
+ for (File srcFile : libs) {
+ File destFile = new File(home + "/" + destPath, srcFile.getName());
+ if (!destFile.exists() || !FileUtils.contentEquals(srcFile, destFile)) {
+ FileUtils.copyFile(srcFile, destFile);
+ logger.info("copy {} to {}", srcFile.getAbsolutePath(), destPath);
+ }
}
}
return libs;