@@ -57,15 +57,15 @@ private Database openDatabase(String dbName, boolean countCheck) throws Couchbas
5757 config .setDirectory (getDir ().getAbsolutePath ());
5858 Database db = new Database (dbName , config );
5959 assertEquals (dbName , db .getName ());
60- assertTrue (db .getPath ().getAbsolutePath ().endsWith (".cblite2" ));
60+ assertTrue (new File ( db .getPath () ).getAbsolutePath ().endsWith (".cblite2" ));
6161 if (countCheck )
6262 assertEquals (0 , db .getCount ());
6363 return db ;
6464 }
6565
6666 // helper method to delete database
6767 void deleteDatabase (Database db ) throws CouchbaseLiteException {
68- File path = db .getPath ();
68+ File path = db .getPath () != null ? new File ( db . getPath ()) : null ;
6969 // if path is null, db is already closed
7070 if (path != null )
7171 assertTrue (path .exists ());
@@ -193,7 +193,7 @@ public void testDatabaseConfigurationWithAndroidContect() throws CouchbaseLiteEx
193193 Database db = new Database ("db" , config );
194194 try {
195195 String expectedPath = context .getFilesDir ().getAbsolutePath ();
196- assertTrue (db .getPath ().getAbsolutePath ().contains (expectedPath ));
196+ assertTrue (new File ( db .getPath () ).getAbsolutePath ().contains (expectedPath ));
197197 } finally {
198198 db .delete ();
199199 }
@@ -271,8 +271,8 @@ public void testCreateWithCustomDirectory() throws CouchbaseLiteException {
271271 try {
272272 assertNotNull (db );
273273 assertEquals (dbName , db .getName ());
274- assertTrue (db .getPath ().getAbsolutePath ().endsWith (".cblite2" ));
275- assertTrue (db .getPath ().getAbsolutePath ().indexOf (dir .getPath ()) != -1 );
274+ assertTrue (new File ( db .getPath () ).getAbsolutePath ().endsWith (".cblite2" ));
275+ assertTrue (new File ( db .getPath () ).getAbsolutePath ().indexOf (dir .getPath ()) != -1 );
276276 assertTrue (Database .exists (dbName , dir ));
277277 assertEquals (0 , db .getCount ());
278278 } finally {
@@ -941,7 +941,7 @@ public void testDelete() throws CouchbaseLiteException {
941941 @ Test
942942 public void testDeleteTwice () throws CouchbaseLiteException {
943943 // delete db twice
944- File path = db .getPath ();
944+ File path = new File ( db .getPath () );
945945 assertTrue (path .exists ());
946946 db .delete ();
947947 try {
@@ -1051,7 +1051,7 @@ public void testDeleteWithDefaultDirDB() throws CouchbaseLiteException {
10511051 String dbName = "db" ;
10521052 try {
10531053 Database database = open (dbName );
1054- File path = database .getPath ();
1054+ File path = new File ( database .getPath () );
10551055 assertNotNull (path );
10561056 assertTrue (path .exists ());
10571057 // close db before delete
@@ -1077,7 +1077,7 @@ public void testDeleteOpeningDBWithDefaultDir() throws CouchbaseLiteException {
10771077 // create db with custom directory
10781078 Database db = openDatabase (dbName );
10791079 try {
1080- File path = db .getPath ();
1080+ File path = new File ( db .getPath () );
10811081 assertNotNull (path );
10821082 assertTrue (path .exists ());
10831083
@@ -1101,7 +1101,7 @@ public void testDeleteByStaticMethod() throws CouchbaseLiteException {
11011101
11021102 // create db with custom directory
11031103 Database db = openDatabase (dbName );
1104- File path = db .getPath ();
1104+ File path = new File ( db .getPath () );
11051105
11061106 // close db before delete
11071107 db .close ();
@@ -1175,7 +1175,7 @@ public void testDatabaseExistsWithDir() throws CouchbaseLiteException {
11751175
11761176 // create db with custom directory
11771177 Database db = openDatabase ("db" );
1178- File path = db .getPath ();
1178+ File path = new File ( db .getPath () );
11791179
11801180 assertTrue (Database .exists ("db" , getDir ()));
11811181
@@ -1322,7 +1322,7 @@ public void testCopy() throws CouchbaseLiteException {
13221322 Database .delete (dbName , dir );
13231323
13241324 // Copy:
1325- Database .copy (db .getPath (), dbName , config );
1325+ Database .copy (new File ( db .getPath () ), dbName , config );
13261326
13271327 // Verify:
13281328 assertTrue (Database .exists (dbName , dir ));
0 commit comments