You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@toree.apache.org by "Gino Bustelo (JIRA)" <ji...@apache.org> on 2016/08/23 14:32:21 UTC

[jira] [Commented] (TOREE-185) %%AddJar downloadFile does not follow HTTP redirects

    [ https://issues.apache.org/jira/browse/TOREE-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15432900#comment-15432900 ] 

Gino Bustelo commented on TOREE-185:
------------------------------------

Example: http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/

> %%AddJar downloadFile does not follow HTTP redirects
> ----------------------------------------------------
>
>                 Key: TOREE-185
>                 URL: https://issues.apache.org/jira/browse/TOREE-185
>             Project: TOREE
>          Issue Type: Bug
>            Reporter: Justin Tyberg
>
> [downloadFile|https://github.com/ibm-et/spark-kernel/blob/master/kernel-api/src/main/scala/com/ibm/spark/utils/DownloadSupport.scala#L38] is intended to download files from URLs, but it does not follow HTTP redirects.  This causes issues when using {{%AddJar}}:
> {code}
> %AddJar http://search.maven.org/remotecontent?filepath=eu/piotrbuda/scalawebsocket_2.10/0.1.1/scalawebsocket_2.10-0.1.1.jar
> {code}
> What gets downloaded in this case is 
> {code}
> $ file scalawebsocket_2.10-0.1.1.jar
> scalawebsocket_2.10-0.1.1.jar: HTML document, ASCII text, with CRLF line terminators
> $ cat scalawebsocket_2.10-0.1.1.jar
> <html>
> <head><title>302 Found</title></head>
> <body bgcolor="white">
> <center><h1>302 Found</h1></center>
> <hr><center>nginx/0.8.55</center>
> </body>
> </html>
> {code}
> Since {{%AddJar}} is expecting an archive file, things go boom.
> {code}
> Starting download from http://search.maven.org/remotecontent?filepath=eu/piotrbuda/scalawebsocket_2.10/0.1.1/scalawebsocket_2.10-0.1.1.jar
> Finished download of scalawebsocket_2.10-0.1.1.jar
> Name: java.util.zip.ZipException
> Message: error in opening zip file
> StackTrace: java.util.zip.ZipFile.open(Native Method)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)