Ignore:
Timestamp:
2016-10-26T10:24:53+13:00 (7 years ago)
Author:
davidb
Message:

More careful parsing of file prefix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/solr-extracted-features/trunk/src/main/java/org/hathitrust/PagedJSON.java

    r30932 r30933  
    4848       
    4949        if (fileIn.startsWith("hdfs://")) {
    50         URI uri = URI.create (fileIn);
    51         Configuration conf = new Configuration();
    52         FileSystem file = FileSystem.get(uri, conf);
    53         FSDataInputStream fin = file.open(new Path(uri));
    54          
    55         bis = new BufferedInputStream(fin);
     50            URI uri = URI.create (fileIn);
     51            Configuration conf = new Configuration();
     52            FileSystem file = FileSystem.get(uri, conf);
     53            FSDataInputStream fin = file.open(new Path(uri));
     54
     55            bis = new BufferedInputStream(fin);
    5656        }
    5757        else {
    58           FileInputStream fin = new FileInputStream(fileIn);
    59           bis = new BufferedInputStream(fin);
     58            // Trim 'file://' off the front
     59           
     60            String local_file_in = fileIn;
     61            if (local_file_in.startsWith("file://")) {
     62                local_file_in = fileIn.substring("file://".length());
     63            }
     64            FileInputStream fin = new FileInputStream(local_file_in);
     65            bis = new BufferedInputStream(fin);
    6066        }
    61        
     67
    6268        return bis;
    6369       
Note: See TracChangeset for help on using the changeset viewer.