You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2015/03/16 18:20:41 UTC

svn commit: r1667074 - /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java

Author: seanfinan
Date: Mon Mar 16 17:20:41 2015
New Revision: 1667074

URL: http://svn.apache.org/r1667074
Log:
CTAKES-345 FileLocator.locateFile(...) un-deprecated.

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=1667074&r1=1667073&r2=1667074&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 Mon Mar 16 17:20:41 2015
@@ -63,15 +63,16 @@ final public class FileLocator {
     }
 	
     /**
-     *  @deprecated As of release 3.1, replaced by {@link #getAsStream(String)} and {@link #getFullPath(String)}
+     * Where a Stream is usable, use {@link #getAsStream(String)} .
+     * Where a path String is usable, use {@link #getFullPath(String)} .
      */
-    @Deprecated
     public static File locateFile( final String location ) throws FileNotFoundException {
-       try {
-          return locateOnClasspath( location );
-       } catch ( Exception e ) {
-          return locateExplicitly( location );
-        }
+       final String fullPath = getFullPath( location );
+       final File file = new File( fullPath );
+       if ( !file.exists() ) {
+          throw new FileNotFoundException( "No File at " + location );
+       }
+       return file;
     }
 
    /**
@@ -181,14 +182,4 @@ final public class FileLocator {
       return new File( indexUri );
     }
 
-    private static File locateExplicitly(String explicitLocation)
-            throws FileNotFoundException
-    {
-        File f = new File(explicitLocation);
-        if (!f.exists())
-        {
-            throw new FileNotFoundException(explicitLocation);
-        }
-        return f;
-    }
 }
\ No newline at end of file