# 1173: solved problem with exception during the cached archive unpacking.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/13fe09ed Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/13fe09ed Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/13fe09ed Branch: refs/heads/ignite-1173 Commit: 13fe09ed0cf2dc2fe4e2e5f4c26d7c7bf3a35e0b Parents: 26c2af4 Author: iveselovskiy <iveselovs...@gridgain.com> Authored: Mon Aug 3 16:30:40 2015 +0300 Committer: iveselovskiy <iveselovs...@gridgain.com> Committed: Mon Aug 3 16:30:40 2015 +0300 ---------------------------------------------------------------------- .../hadoop/v2/HadoopV2JobResourceManager.java | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/13fe09ed/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java index 8aca440..dd98ea7 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/v2/HadoopV2JobResourceManager.java @@ -182,6 +182,9 @@ class HadoopV2JobResourceManager { Collection<String> res = new ArrayList<>(); + // Fragment identifier of the URI: + String fragment = null; + for (Object pathObj : files) { String locName = null; Path srcPath; @@ -189,17 +192,27 @@ class HadoopV2JobResourceManager { if (pathObj instanceof URI) { URI uri = (URI)pathObj; - locName = uri.getFragment(); + //locName = uri.getPath(); + fragment = uri.getFragment(); + + try { + URI uriWithoutFragment = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), null, null); - srcPath = new Path(uri); + srcPath = new Path(uriWithoutFragment); + } + catch (URISyntaxException use) { + throw new IOException(use); + } } else srcPath = (Path)pathObj; - if (locName == null) - locName = srcPath.getName(); + //if (locName == null) + locName = srcPath.getName(); + + String dstName = (fragment == null) ? locName : fragment; - File dstPath = new File(jobLocDir.getAbsolutePath(), locName); + final File dstPath = new File(jobLocDir.getAbsolutePath(), dstName); res.add(locName); @@ -247,6 +260,9 @@ class HadoopV2JobResourceManager { else // ***** fail there: throw new IOException("Cannot unpack archive [path=" + srcPath + ", jobId=" + jobId + ']'); + + // By contract, all the files should be executable: + FileUtil.chmod(dstPath.getAbsolutePath(), "a+x", true); } else FileUtil.copy(srcFs, srcPath, dstFs, new Path(dstPath.toString()), false, cfg);