Repository: zeppelin
Updated Branches:
  refs/heads/master 71632967d -> 752c8abba


Downloading dependency/changing version for an interpreter results in error 
sometimes

### What is this PR for?
At times on downloading dependency/changing version for an interpreter results 
in error

```
 INFO [2016-11-29 11:16:52,998] ({qtp60559178-18} 
InterpreterRestApi.java[updateSetting]:137) - Update interpreterSetting 
2C2ENJBEV
ERROR [2016-11-29 11:16:53,047] ({Thread-61} InterpreterFactory.java[run]:494) 
- Error while downloading repos for interpreter group : jdbc, go to interpreter 
setting page click on edit and save it again to make this interpreter work 
properly. : File does not exist: 
/Users/xxx/local-repo/2C2ENJBEV/twill-zookeeper-0.6.0-incubating.jar
java.io.FileNotFoundException: File does not exist: 
/Users/xxx/local-repo/2C2ENJBEV/twill-zookeeper-0.6.0-incubating.jar
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2275)
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
        at 
org.apache.zeppelin.interpreter.InterpreterFactory$3.run(InterpreterFactory.java:470)
ERROR [2016-11-29 11:16:53,047] ({Thread-64} InterpreterFactory.java[run]:494) 
- Error while downloading repos for interpreter group : jdbc, go to interpreter 
setting page click on edit and save it again to make this interpreter work 
properly. : File does not exist: 
/Users/xxx/local-repo/2C2ENJBEV/zookeeper-3.4.6.jar
java.io.FileNotFoundException: File does not exist: 
/Users/xxx/local-repo/2C2ENJBEV/zookeeper-3.4.6.jar
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:2275)
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1653)
        at 
org.apache.zeppelin.interpreter.InterpreterFactory$3.run(InterpreterFactory.java:470)
```

but on re-saving it works fine.

### What type of PR is it?
[Bug Fix]

### Todos

### What is the Jira issue?
* [ZEPPELIN-1725](https://issues.apache.org/jira/browse/ZEPPELIN-1725)

### How should this be tested?
Configure following as dependencies in JDBC
```
org.apache.hive:hive-jdbc:2.0.1
org.apache.hadoop:hadoop-common:2.7.1
org.apache.hive.shims:hive-shims-0.23:2.1.0
org.apache.phoenix:phoenix-core:4.7.0-HBase-1.1
```
now try changing one of it, say "org.apache.hadoop:hadoop-common:2.7.1" to 
"org.apache.hadoop:hadoop-common:2.6.0"

Save should happen all the time.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Prabhjyot Singh <prabhjyotsi...@gmail.org>

Closes #1698 from prabhjyotsingh/ZEPPELIN-1725 and squashes the following 
commits:

b535bb9 [Prabhjyot Singh] do a check for FileNotFoundException, which would 
mean it was already deleted/not present.


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/752c8abb
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/752c8abb
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/752c8abb

Branch: refs/heads/master
Commit: 752c8abba15dd8caee99b542bf09d702681a77fc
Parents: 7163296
Author: Prabhjyot Singh <prabhjyotsi...@gmail.org>
Authored: Tue Nov 29 12:33:32 2016 +0530
Committer: Prabhjyot Singh <prabhjyotsi...@gmail.org>
Committed: Wed Nov 30 10:27:41 2016 +0530

----------------------------------------------------------------------
 .../org/apache/zeppelin/interpreter/InterpreterFactory.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/752c8abb/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
index 11c9f68..e4ea916 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java
@@ -466,7 +466,11 @@ public class InterpreterFactory implements 
InterpreterGroupFactory {
             File localRepoDir = new File(conf.getInterpreterLocalRepoPath() + 
"/" +
                 setting.getId());
             if (localRepoDir.exists()) {
-              FileUtils.cleanDirectory(localRepoDir);
+              try {
+                FileUtils.cleanDirectory(localRepoDir);
+              } catch (FileNotFoundException e) {
+                logger.info("A file that does not exist cannot be deleted, 
nothing to worry", e);
+              }
             }
 
             // load dependencies

Reply via email to