Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master d39b8dba3 -> 9c33b7e21


[ZEPPELIN-941] jsoup NoSuchMethodError in ZeppelinRDisplay.scala

### What is this PR for?
Since version 1.8.2 of jsoup, org.jsoup.select.Elements class no longer has 
"get(int index)" method. It contradicts to <jsoup.version>1.8.2</jsoup.version> 
written in scala/pom.xml. Currently %r scripts fail with 
"java.lang.NoSuchMethodError: 
org.jsoup.select.Elements.get(I)Lorg/jsoup/nodes/Element;"

This PR changes obsolete get(0) method to more universal and logically 
equivalent first() method, removing error message and removing 1.8.1 
restriction to jsoup library (at least in ZeppelinRDisplay part of zeppelin).

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

### Todos
* [ ] - Task

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

### How should this be tested?
Execute R-Tutorial Notebook in default installation of zeppelin and confirm 
that you can see output.

### Questions:
It shouldn't break older versions.

Author: Andrey Oskin <a.os...@corp.mail.ru>

Closes #949 from Arkoniak/rdisplay_jsoup_fix and squashes the following commits:

3d05400 [Andrey Oskin] jsoup get(0) to first()


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

Branch: refs/heads/master
Commit: 9c33b7e21eef41d604a58a16d8c364e35b25a1c3
Parents: d39b8db
Author: Andrey Oskin <a.os...@corp.mail.ru>
Authored: Thu Jun 2 10:12:38 2016 +0300
Committer: Lee moon soo <m...@apache.org>
Committed: Fri Jun 3 21:50:22 2016 -0700

----------------------------------------------------------------------
 .../scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala     | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/9c33b7e2/spark/src/main/scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala
----------------------------------------------------------------------
diff --git 
a/spark/src/main/scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala 
b/spark/src/main/scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala
index 8607226..8419a11 100644
--- a/spark/src/main/scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala
+++ b/spark/src/main/scala/org/apache/zeppelin/spark/ZeppelinRDisplay.scala
@@ -68,18 +68,18 @@ object ZeppelinRDisplay {
   }
 
   private def textDisplay(body: Element): RDisplay = {
-    RDisplay(body.getElementsByTag("p").get(0).html(), TEXT, SUCCESS)
+    RDisplay(body.getElementsByTag("p").first().html(), TEXT, SUCCESS)
   }
 
   private def tableDisplay(body: Element): RDisplay = {
-    val p = body.getElementsByTag("p").get(0).html.replace("“%table " , 
"").replace("”", "")
+    val p = body.getElementsByTag("p").first().html.replace("“%table " , 
"").replace("”", "")
     val r = (pattern findFirstIn p).getOrElse("")
     val table = p.replace(r, "").replace("\\t", "\t").replace("\\n", "\n")
     RDisplay(table, TABLE, SUCCESS)
   }
 
   private def imgDisplay(body: Element): RDisplay = {
-    val p = body.getElementsByTag("p").get(0).html.replace("“%img " , 
"").replace("”", "")
+    val p = body.getElementsByTag("p").first().html.replace("“%img " , 
"").replace("”", "")
     val r = (pattern findFirstIn p).getOrElse("")
     val img = p.replace(r, "")
     RDisplay(img, IMG, SUCCESS)

Reply via email to