asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject incubator-asterixdb git commit: Decode URLs Returned From Class.getResource()
Date Fri, 18 Mar 2016 10:57:11 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 3da9d068a -> 63026e64b


Decode URLs Returned From Class.getResource()

Fix ClassAd tests failing when there is a space in the path, by
properly decoding the URLs with URLDecoder.

Change-Id: Ib7fd5a4e33ba3e16c1b5124179a15ae78d08c18a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/725
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/63026e64
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/63026e64
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/63026e64

Branch: refs/heads/master
Commit: 63026e64bba274b3b6eda78537cb4232257733b3
Parents: 3da9d06
Author: Michael Blow <michael.blow@couchbase.com>
Authored: Thu Mar 17 15:46:13 2016 -0400
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Fri Mar 18 03:51:44 2016 -0700

----------------------------------------------------------------------
 .../asterix/external/classad/test/ClassAdFunctionalTest.java  | 4 +++-
 .../asterix/external/classad/test/ClassAdParserTest.java      | 7 ++++---
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/63026e64/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
index 2f23684..09e8001 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdFunctionalTest.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.external.classad.test;
 
+import java.net.URLDecoder;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -45,8 +47,8 @@ public class ClassAdFunctionalTest extends TestCase {
      */
     public void testApp() {
 
-        String[] args = { "", "-d", "-v", getClass().getResource("/functional_tests.txt").getPath()
};
         try {
+            String[] args = { "", "-d", "-v", URLDecoder.decode(getClass().getResource("/functional_tests.txt").getPath(),
"UTF-8") };
             FunctionalTester.test(args.length, args);
         } catch (Exception e) {
             e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/63026e64/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
index 1c135f5..d65fecc 100644
--- a/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
+++ b/asterix-external-data/src/test/java/org/apache/asterix/external/classad/test/ClassAdParserTest.java
@@ -19,16 +19,17 @@
 package org.apache.asterix.external.classad.test;
 
 import java.io.BufferedReader;
+import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
-import org.apache.asterix.external.classad.ClassAd;
-
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
+import org.apache.asterix.external.classad.ClassAd;
+
 public class ClassAdParserTest extends TestCase {
     /**
      * Create the test case
@@ -58,7 +59,7 @@ public class ClassAdParserTest extends TestCase {
             String[] files = new String[] { "/testdata.txt" };
             BufferedReader infile = null;
             for (String path : files) {
-                infile = Files.newBufferedReader(Paths.get(getClass().getResource(path).getPath()),
+                infile = Files.newBufferedReader(Paths.get(URLDecoder.decode(getClass().getResource(path).getPath(),
"UTF-8")),
                         StandardCharsets.UTF_8);
                 szInput = infile.readLine();
                 while (szInput != null) {


Mime
View raw message