Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill >> mail # dev >> [3/5] git commit: DRILL-213: Test cases fail on Windows


Copy link to this message
-
[3/5] git commit: DRILL-213: Test cases fail on Windows
DRILL-213: Test cases fail on Windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/4b192494
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/4b192494
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/4b192494

Branch: refs/heads/master
Commit: 4b1924944cd7c941b088488a558dd8f56a6fb27e
Parents: ad992eb
Author: Aditya Kishore <[EMAIL PROTECTED]>
Authored: Wed Sep 4 19:43:59 2013 -0700
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Thu Sep 5 17:01:14 2013 -0700

----------------------------------------------------------------------
 .../org/apache/drill/common/util/FileUtils.java  |  4 ++++
 .../drill/exec/compile/ClassTransformer.java     | 19 ++++++++++---------
 .../drill/exec/expr/fn/FunctionConverter.java    |  5 +++--
 3 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4b192494/common/src/main/java/org/apache/drill/common/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/FileUtils.java b/common/src/main/java/org/apache/drill/common/util/FileUtils.java
index f38f9d2..455cb62 100644
--- a/common/src/main/java/org/apache/drill/common/util/FileUtils.java
+++ b/common/src/main/java/org/apache/drill/common/util/FileUtils.java
@@ -28,6 +28,10 @@ import com.google.common.io.Files;
 public class FileUtils {
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FileUtils.class);
 
+  public static final char separatorChar = '/';
+
+  public static final String separator = "" + separatorChar;
+
   public static File getResourceAsFile(String fileName) throws IOException {
     URL u = FileUtils.class.getResource(fileName);
     if (u == null) throw new FileNotFoundException(String.format("Unable to find file on path %s", fileName));

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/4b192494/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
index d549db4..4a934f9 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/ClassTransformer.java
@@ -27,6 +27,7 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
+import org.apache.drill.common.util.FileUtils;
 import org.apache.drill.exec.exception.ClassTransformationException;
 import org.codehaus.commons.compiler.CompileException;
 import org.objectweb.asm.ClassReader;
@@ -114,8 +115,8 @@ public class ClassTransformer {
       final byte[] implementationClass = classLoader.getClassByteCode(materializedClassName, entireClass);
 
       // Get Template Class
-      final String templateClassName = templateDefinition.getTemplateClassName().replaceAll("\\.", File.separator);
-      final String templateClassPath = File.separator + templateClassName + ".class";
+      final String templateClassName = templateDefinition.getTemplateClassName().replace('.', FileUtils.separatorChar);
+      final String templateClassPath = FileUtils.separator + templateClassName + ".class";
       t1.stop();
       Stopwatch t2 = new Stopwatch().start();
       final byte[] templateClass = getClassByteCodeFromPath(templateClassPath);
@@ -125,8 +126,8 @@ public class ClassTransformer {
 
       // Setup adapters for merging, remapping class names and class writing. This is done in reverse order of how they
       // will be evaluated.
-      String oldTemplateSlashName = templateDefinition.getTemplateClassName().replace('.', '/');
-      String materializedSlashName = materializedClassName.replace('.', '/');
+      String oldTemplateSlashName = templateDefinition.getTemplateClassName().replace('.', FileUtils.separatorChar);
+      String materializedSlashName = materializedClassName.replace('.', FileUtils.separatorChar);
       RemapClasses remapper = new RemapClasses(oldTemplateSlashName, materializedSlashName);
      
       Stopwatch t3;
@@ -157,7 +158,7 @@ public class ClassTransformer {
       for (String s : remapper.getSubclasses()) {
         logger.debug("Setting up sub class {}", s);
         // for each sub class, remap them into the new class.
-        String subclassPath = File.separator + s + ".class";
+        String subclassPath = FileUtils.separator + s + ".class";
         final byte[] bytecode = getClassByteCodeFromPath(subclassPath);
         RemapClasses localRemapper = new RemapClasses(oldTemplateSlashName, materializedSlashName);
         Preconditions.checkArgument(localRemapper.getSubclasses().isEmpty(), "Class transformations are only supported for classes that have a single level of inner classes.");
@@ -166,7 +167,7 @@ public class ClassTransformer {
         ClassReader reader = new ClassReader(bytecode);
         reader.accept(remap, ClassReader.EXPAND_FRAMES);
         byte[] newByteCode = subcw.toByteArray();
-        classLoader.injectByteCode(s.replace(oldTemplateSlashName, materializedSlashName).replace('/', '.'), newByteCode);
+        classLoader.injectByteCode(s.replace(oldTemplateSlashName, materializedSlashName).replace(FileUtils.separatorChar, '.'), newByteCode);
 //        Files.write(subcw.toByteArray(), new File(String.format("/tmp/%d-sub-%d.class", fileNum, i)));
         i++;
       }
@@ -209,7 +210,7 @@ public class ClassTransformer {
       super(Opcodes.ASM4, cv);
       this.classToMerge = cn;
       this.templateName = templateName;
-      this.newName = newName.r