incubator-toree icon indicating copy to clipboard operation
incubator-toree copied to clipboard

Allow also URLs with additional parameters

Open kamir opened this issue 8 years ago • 4 comments

Not all URLs end with JAR or ZIP, e.g., if we load content from an HTTPFS Service.

Examples for testing: (a,c,d work as expeced) (b => more logic needed to create a JAR name from this URL)

import java.io.{File, PrintStream} import java.net.URL import java.nio.file.{Files, Paths}

def getFileFromLocation(location: String): String = { val url = new URL(location) val file = url.getFile.split("/") if (file.length > 0) { if ( file.last.contains('?') ) { file.last.split('?')(0) } else { file.last }
} else { "" } }

val fnA = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar?user.name=123" val a = getFileFromLocation(fnA) a

val fnB = "https://oss.sonatype.org/service/local/artifact/maven/content?r=snapshots&g=org.gephi&a=gephi-toolkit&v=0.9.2-SNAPSHOT&c=all" val b = getFileFromLocation(fnB) b

val fnC = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar" val c = getFileFromLocation(fnC) c

val fnD = "http://cdsw-mk4-1.gce.cloudera.com:8888/filebrowser/download=/user/systest/TOOLBOX/SparkShellUtilities.jar?user.name=123&doas=123456" val d = getFileFromLocation(fnD) d

kamir avatar Mar 23 '17 11:03 kamir

@kamir Could you please update AddJarSpec.scala with some tests that validate your additions.

lresende avatar Mar 24 '17 20:03 lresende

Welcome @kamir! Thanks for finding this bug and working on a fix. Check out this documentation on URL https://docs.oracle.com/javase/7/docs/api/java/net/URL.html#getFile(), I think a simpler fix is to just change the "getFile" part above to "getPath"

jodersky avatar Mar 27 '17 19:03 jodersky

@kamir Could you please rebase and add a test case to the enhancements you are making.

lresende avatar Aug 19 '17 04:08 lresende

My plan is to work on this during the next week. Best wishes, Mirko

On Sat, Aug 19, 2017 at 6:21 AM, Luciano Resende [email protected] wrote:

@kamir https://github.com/kamir Could you please rebase and add a test case to the enhancements you are making.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/incubator-toree/pull/118#issuecomment-323499329, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLwIlZ8CxINgXlYMxqe2cQQ77aecMaVks5sZmKygaJpZM4Mml0G .

kamir avatar Aug 20 '17 16:08 kamir