Changeset 1450


Ignore:
Timestamp:
Nov 3, 2011, 8:52:08 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #304: Implement HDFS external file support

Fixed a NullPointerException? when file doesn't exists on the hdfs file system. Now throws a FileNotFoundException? instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.hdfs/trunk/src/net/sf/basedb/hdfs/HdfsConnectionManager.java

    r1330 r1450  
    2222package net.sf.basedb.hdfs;
    2323
     24import java.io.FileNotFoundException;
    2425import java.io.IOException;
    2526import java.io.InputStream;
     
    8283      if (port == -1) port = 9000;
    8384      client = createClient(uri, parameters);
    84       stream = new CloseResourceInputStream(client.open(uri.getPath()), client);
     85      InputStream tmp = client.open(uri.getPath());
     86      if (tmp == null)
     87      {
     88        throw new FileNotFoundException(uri.toString());
     89      }
     90      stream = new CloseResourceInputStream(tmp, client);
    8591    }
    8692    finally
     
    103109      {
    104110        client = createClient(uri, parameters);
    105         metadata = createMetadata(uri, client.getFileInfo(uri.getPath()));
     111        HdfsFileStatus status = client.getFileInfo(uri.getPath());
     112        if (status == null)
     113        {
     114          throw new FileNotFoundException(uri.toString());
     115        }
     116        metadata = createMetadata(uri, status);
    106117      }
    107118      finally
Note: See TracChangeset for help on using the changeset viewer.