Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Use the class Path to represent a path instead of a String. #81

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public abstract class MatrixSumAggregator {
*/
private String name;
/** Cache the names of the columns */
private ArrayList<String> names = new ArrayList<String>();
private ArrayList<String> names = new ArrayList<>();

/**
* Create a new matrix aggregator with the given prefix name for the vector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
import java.io.InputStream;
import java.util.List;

import java.nio.file.Path;
import java.nio.file.Paths;

import static org.apache.giraph.utils.DistributedCacheUtils.getLocalCacheFile;

/**
Expand Down Expand Up @@ -213,7 +216,7 @@ public static List<DeployedScript> getLoadedScripts() {
private static InputStream openScriptInputStream(Configuration conf,
DeployedScript deployedScript) {
DeployType deployType = deployedScript.getDeployType();
String path = deployedScript.getPath();
Path path = Paths.get(deployedScript.getPath());

InputStream stream;
switch (deployType) {
Expand All @@ -222,7 +225,7 @@ private static InputStream openScriptInputStream(Configuration conf,
LOG.info("getScriptStream: Reading script from resource at " +
deployedScript.getPath());
}
stream = ScriptLoader.class.getClassLoader().getResourceAsStream(path);
stream = ScriptLoader.class.getClassLoader().getResourceAsStream(path.toString());
if (stream == null) {
throw new IllegalStateException("getScriptStream: Failed to " +
"open script from resource at " + path);
Expand All @@ -233,7 +236,7 @@ private static InputStream openScriptInputStream(Configuration conf,
LOG.info("getScriptStream: Reading script from DistributedCache at " +
path);
}
Optional<Path> localPath = getLocalCacheFile(conf, path);
Optional<Path> localPath = getLocalCacheFile(conf, path.toString());
if (!localPath.isPresent()) {
throw new IllegalStateException("getScriptStream: Failed to " +
"find script in local DistributedCache matching " + path);
Expand Down