ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From james-mas...@apache.org
Subject svn commit: r1505011 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
Date Fri, 19 Jul 2013 20:53:08 GMT
Author: james-masanz
Date: Fri Jul 19 20:53:08 2013
New Revision: 1505011

URL: http://svn.apache.org/r1505011
Log:
CTAKES-218 Have FileLocator also try the second method to resolve the file path if the first
returns null (in addition to if the first throws an exception)

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java?rev=1505011&r1=1505010&r2=1505011&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
Fri Jul 19 20:53:08 2013
@@ -38,11 +38,14 @@ public class FileLocator
         try
         {
         	//Get from classpath
-        	return FileLocator.class.getClassLoader().getResourceAsStream(location);
+        	InputStream is  = FileLocator.class.getClassLoader().getResourceAsStream(location);
+        	if (is==null) throw new RuntimeException("Unable to locate " + location + " on classpath.");
+        	return is;
         }
         catch (Exception e)
         {
-        	//Try to get from filestream
+        	//Try to get from filestream, locating relative to the current directory if 
+        	// location is a relative path
         	File f = new File(location);
         	FileInputStream fs = new FileInputStream(f);
         	return fs;



Mime
View raw message