You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by mb...@apache.org on 2006/12/19 18:47:08 UTC

svn commit: r488740 - /incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java

Author: mbaessler
Date: Tue Dec 19 09:47:07 2006
New Revision: 488740

URL: http://svn.apache.org/viewvc?view=rev&rev=488740
Log:
JIRA ticket UIMA-45 (https://issues.apache.org/jira/browse/UIMA-45)

rewrite JUnitExtension.getFile() method to load files using the classloader.

When changing this method I also deleted the TestPropertyReader class which is now never used.

With these two changes above, there where lots of tests that must also be changed and adapted
to the new methods.

Modified:
    incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java

Modified: incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java?view=diff&rev=488740&r1=488739&r2=488740
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-test-util/src/main/java/org/apache/uima/test/junit_extension/JUnitExtension.java Tue Dec 19 09:47:07 2006
@@ -21,7 +21,6 @@
 
 import java.io.File;
 import java.io.UnsupportedEncodingException;
-import java.net.URI;
 import java.net.URL;
 import java.net.URLDecoder;
 
@@ -33,30 +32,21 @@
  * @author Adam Lally
  */
 public class JUnitExtension {
-  //private static String junitTestBasePath = TestPropertyReader.getJUnitTestBasePath();
 
-  
-//  public static File getFile(String aRelativeFilePath) {
-//    return new File(junitTestBasePath, aRelativeFilePath);
-//  }
-  
   public static File getFile(String aRelativeFilePath) {
     URL url = JUnitExtension.class.getClassLoader().getResource(aRelativeFilePath);
     File file = null;
-    if(url != null) {
-      String fileURL = null;
+    if (url != null) {
       try {
-        //TODO: use Java 1.5 decoding 
-        fileURL = URLDecoder.decode(url.getFile(), "UTF-8");
+        // TODO: use Java 1.5 decoding
+        String fileURL = URLDecoder.decode(url.getFile(), "UTF-8");
+        file = new File(fileURL);
       } catch (UnsupportedEncodingException ex) {
-        // TODO Auto-generated catch block
-        ex.printStackTrace();
+        return null;
       }
-      file = new File(fileURL);
     }
     return file;
-  } 
-
+  }
 
   public static void handleException(Exception e) throws Exception {
     // check command line setting