You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by td...@apache.org on 2015/06/24 22:30:06 UTC

[15/16] phoenix git commit: PHOENIX-2068 UserDefinedFunctionsIT is failing in windows with InvocationTargetException(Rajeshbabu)

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/50f3a041
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/50f3a041
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/50f3a041

Branch: refs/heads/json
Commit: 50f3a04126c4fea59dc9eb978cef1399892d9a4a
Parents: b58a62a
Author: Rajeshbabu Chintaguntla <ra...@apache.org>
Authored: Thu Jun 25 00:44:25 2015 +0530
Committer: Rajeshbabu Chintaguntla <ra...@apache.org>
Committed: Thu Jun 25 00:44:25 2015 +0530

----------------------------------------------------------------------
 .../phoenix/end2end/UserDefinedFunctionsIT.java | 22 ++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/50f3a041/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);