diff --git a/giraph-core/src/main/java/org/apache/giraph/aggregators/matrix/MatrixSumAggregator.java b/giraph-core/src/main/java/org/apache/giraph/aggregators/matrix/MatrixSumAggregator.java index 8ed6bd85a..f3233d658 100644 --- a/giraph-core/src/main/java/org/apache/giraph/aggregators/matrix/MatrixSumAggregator.java +++ b/giraph-core/src/main/java/org/apache/giraph/aggregators/matrix/MatrixSumAggregator.java @@ -32,7 +32,7 @@ public abstract class MatrixSumAggregator { */ private String name; /** Cache the names of the columns */ - private ArrayList names = new ArrayList(); + private ArrayList names = new ArrayList<>(); /** * Create a new matrix aggregator with the given prefix name for the vector diff --git a/giraph-core/src/main/java/org/apache/giraph/scripting/ScriptLoader.java b/giraph-core/src/main/java/org/apache/giraph/scripting/ScriptLoader.java index e7485a448..03d0bfe4c 100644 --- a/giraph-core/src/main/java/org/apache/giraph/scripting/ScriptLoader.java +++ b/giraph-core/src/main/java/org/apache/giraph/scripting/ScriptLoader.java @@ -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; /** @@ -213,7 +216,7 @@ public static List 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) { @@ -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); @@ -233,7 +236,7 @@ private static InputStream openScriptInputStream(Configuration conf, LOG.info("getScriptStream: Reading script from DistributedCache at " + path); } - Optional localPath = getLocalCacheFile(conf, path); + Optional localPath = getLocalCacheFile(conf, path.toString()); if (!localPath.isPresent()) { throw new IllegalStateException("getScriptStream: Failed to " + "find script in local DistributedCache matching " + path);