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 2017/01/13 21:42:44 UTC

zeppelin git commit: [ZEPPELIN-1560] avoid generating minus sign in package name

Repository: zeppelin
Updated Branches:
  refs/heads/master 034fdc673 -> 068c89462


[ZEPPELIN-1560] avoid generating minus sign in package name

### What is this PR for?
using Object.hashCode() as part of the REPL wrapper class name can cause a compilation error as hashCode can validly return a negative integer.

We would like this fix backported to 0.6 and later streams.

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

### Todos
* [ ] - Task

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1560

### How should this be tested?
regression tests with openJdk + tests with IBM jvm

### Screenshots (if appropriate)
N/A

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

Author: robbins <ro...@uk.ibm.com>

Closes #1894 from robbinspg/ZPPELIN-1560 and squashes the following commits:

eeef3ad [robbins] [ZEPPELIN-1560] avoid generating minus sign in package name


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

Branch: refs/heads/master
Commit: 068c8946211823ac98fc7dbf8061da6e9a2712c3
Parents: 034fdc6
Author: robbins <ro...@uk.ibm.com>
Authored: Thu Jan 12 15:15:29 2017 +0000
Committer: Lee moon soo <mo...@apache.org>
Committed: Fri Jan 13 13:42:39 2017 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/zeppelin/spark/SparkInterpreter.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/068c8946/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
----------------------------------------------------------------------
diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
index 301dd23..16bc4ba 100644
--- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
+++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java
@@ -745,8 +745,12 @@ public class SparkInterpreter extends Interpreter {
      *
      * In Spark 2.x, REPL generated wrapper class name should compatible with the pattern
      * ^(\$line(?:\d+)\.\$read)(?:\$\$iw)+$
+     *
+     * As hashCode() can return a negative integer value and the minus character '-' is invalid
+     * in a package name we change it to a numeric value '0' which still conforms to the regexp.
+     * 
      */
-    System.setProperty("scala.repl.name.line", "$line" + this.hashCode());
+    System.setProperty("scala.repl.name.line", ("$line" + this.hashCode()).replace('-', '0'));
 
     // To prevent 'File name too long' error on some file system.
     MutableSettings.IntSetting numClassFileSetting = settings.maxClassfileName();