Skip to content

Commit

Permalink
#7580 fix por parsing sparkex.jar path (#7591)
Browse files Browse the repository at this point in the history
* #7580 fix por parsing sparkex.jar path

* #7580 additional fix for windows path in sparkui test
  • Loading branch information
lmitusinski authored and scottdraves committed Jun 27, 2018
1 parent 6586c08 commit 534ea94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import com.twosigma.beakerx.kernel.magic.command.functionality.ClasspathAddJarMagicCommand;
import com.twosigma.beakerx.kernel.magic.command.outcome.MagicCommandOutcomeItem;

import java.io.File;
import java.net.URLDecoder;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;

public class SparkexJarServiceImpl implements SparkexJarService {
Expand All @@ -36,10 +39,8 @@ public MagicCommandOutcomeItem addSparkexJar(KernelFunctionality kernel) {

private String getSparkexJar() {
try {
String path = EnableSparkSupportMagicCommand.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = URLDecoder.decode(path, "UTF-8")
.replace("scala/lib/scala.jar", "sparkex/lib/sparkex.jar");
return decodedPath;
Path path = Paths.get(EnableSparkSupportMagicCommand.class.getProtectionDomain().getCodeSource().getLocation().toURI());
return path.getParent().getParent().getParent().resolve("sparkex").resolve("lib").resolve("sparkex.jar").toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.Test;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand Down Expand Up @@ -51,9 +52,9 @@ public class SparkUiDefaultsImplTest {
private final String SPARK_OPT = "config";

@Before
public void setUp() {
String path = this.getClass().getClassLoader().getResource("beakerxTest.json").getPath();
this.pathToBeakerxTestJson = Paths.get(path);
public void setUp() throws URISyntaxException {
Path path = Paths.get(this.getClass().getClassLoader().getResource("beakerxTest.json").toURI());
this.pathToBeakerxTestJson = path;
this.sut = new SparkUiDefaultsImpl(pathToBeakerxTestJson);
}

Expand Down

0 comments on commit 534ea94

Please sign in to comment.