ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1653607 - /ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
Date Wed, 21 Jan 2015 17:14:11 GMT
Author: seanfinan
Date: Wed Jan 21 17:14:10 2015
New Revision: 1653607

URL: http://svn.apache.org/r1653607
Log:
CTAKES-345 Still trying to fix relative up paths, added debug log info

Modified:
    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java

Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java?rev=1653607&r1=1653606&r2=1653607&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
(original)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/JdbcConnectionFactory.java
Wed Jan 21 17:14:10 2015
@@ -56,7 +56,7 @@ public enum JdbcConnectionFactory {
       String trueJdbcUrl = jdbcUrl;
       if ( jdbcUrl.startsWith( HSQL_FILE_PREFIX ) ) {
          // Hack for hsqldb file needing to be absolute or relative to current working directory
-         trueJdbcUrl = getConnectionUrl( jdbcUrl );
+         trueJdbcUrl = HSQL_FILE_PREFIX + getConnectionUrl( jdbcUrl );
       }
       try {
          // DO NOT use try with resources here.
@@ -95,12 +95,14 @@ public enum JdbcConnectionFactory {
       final String urlDbPath = jdbcUrl.substring( HSQL_FILE_PREFIX.length() );
       final String urlFilePath = urlDbPath + HSQL_DB_EXT;
       File file = new File( urlFilePath );
+      LOGGER.info( "absolute url: " + file.getPath() + " , use " + urlDbPath );
       if ( file.exists() ) {
          return urlDbPath;
       }
       // file url is not absolute, check for relative directly under current working directory
       final String cwd = System.getProperty( "user.dir" );
       file = new File( cwd, urlFilePath );
+      LOGGER.info( "cwd relative url: " + file.getPath() + " , use " + urlDbPath );
       if ( file.exists() ) {
          return urlDbPath;
       }
@@ -110,6 +112,7 @@ public enum JdbcConnectionFactory {
       while ( cwdDerived.getParentFile() != null ) {
          cwdDerived = cwdDerived.getParentFile();
          file = new File( cwdDerived, urlFilePath );
+         LOGGER.info( "cwd parent relative url: " + file.getPath() + " , use " + upOne +
urlDbPath );
          if ( file.exists() ) {
             return upOne+urlDbPath;
          }
@@ -118,13 +121,14 @@ public enum JdbcConnectionFactory {
       final String cTakesHome = System.getenv( CTAKES_HOME );
       if ( cTakesHome != null && !cTakesHome.isEmpty() ) {
          file = new File( cTakesHome, urlFilePath );
+         LOGGER.info( "$CTAKES_HOME absolute url: " + file.getPath() + " , use " + cTakesHome
+ "/" + urlDbPath );
          if ( file.exists() ) {
             return cTakesHome + "/" + urlDbPath;
          }
       }
       LOGGER.error( "Could not find " + urlFilePath + " as absolute or in \n" + cwd
               + " or in any parent thereof or in $CTAKES_HOME \n" + cTakesHome );
-      throw new SQLException( "No HsqlDB script file exists at Url" );
+      throw new SQLException( "No Hsql DB exists at Url" );
    }
 
    static private class DotPlotter extends TimerTask {



Mime
View raw message