Repository: phoenix Updated Branches: refs/heads/4.4-HBase-1.0 ac7dc675e -> a496896fc
PHOENIX-2068 UserDefinedFunctionsIT is failing in windows with InvocationTargetException(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/a496896f Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/a496896f Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/a496896f Branch: refs/heads/4.4-HBase-1.0 Commit: a496896fc980b330b4c5b1b9f9b7f438e4f972e8 Parents: ac7dc67 Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Authored: Thu Jun 25 00:46:42 2015 +0530 Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Committed: Thu Jun 25 00:46:42 2015 +0530 ---------------------------------------------------------------------- .../phoenix/end2end/UserDefinedFunctionsIT.java | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/a496896f/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java index c6bd62f..cee1c85 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java @@ -36,8 +36,10 @@ import java.io.OutputStream; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; +import java.util.HashSet; import java.util.Map; import java.util.Properties; +import java.util.Set; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarOutputStream; @@ -614,10 +616,22 @@ public class UserDefinedFunctionsIT extends BaseOwnClusterIT{ manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); FileOutputStream jarFos = new FileOutputStream(jarPath); JarOutputStream jarOutputStream = new JarOutputStream(jarFos, manifest); - String pathToAdd =packageName.replace('.', File.separatorChar) - + File.separator; - jarOutputStream.putNextEntry(new JarEntry(pathToAdd)); - jarOutputStream.closeEntry(); + String pathToAdd = packageName.replace('.', '/') + '/'; + String jarPathStr = new String(pathToAdd); + Set<String> pathsInJar = new HashSet<String>(); + + while (pathsInJar.add(jarPathStr)) { + int ix = jarPathStr.lastIndexOf('/', jarPathStr.length() - 2); + if (ix < 0) { + break; + } + jarPathStr = jarPathStr.substring(0, ix); + } + for (String pathInJar : pathsInJar) { + jarOutputStream.putNextEntry(new JarEntry(pathInJar)); + jarOutputStream.closeEntry(); + } + jarOutputStream.putNextEntry(new JarEntry(pathToAdd + classFile.getName())); byte[] allBytes = new byte[(int) classFile.length()]; FileInputStream fis = new FileInputStream(classFile);