Changeset 31499 for other-projects

Show
Ignore:
Timestamp:
13.03.2017 13:54:54 (21 months ago)
Author:
davidb
Message:

Better exception handling

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/src/main/java/org/hathitrust/extractedfeatures/SolrDocJSON.java

    r31378 r31499  
    44import java.io.BufferedWriter; 
    55import java.io.IOException; 
     6import java.io.InputStream; 
    67import java.io.InputStreamReader; 
    78import java.io.OutputStream; 
     
    557558    } 
    558559     
    559     public static void postSolrDoc(String post_url, JSONObject solr_add_doc_json) 
     560        public static void postSolrDoc(String post_url, JSONObject solr_add_doc_json, 
     561                       String volume_id, String page_id) 
    560562    { 
    561563         
     
    566568 
    567569 
    568         System.out.println("**** post_url = " + post_url); 
     570            // System.out.println("Post URL: " + post_url); 
    569571         
    570572        try { 
     
    584586            // Read response 
    585587            StringBuilder sb = new StringBuilder(); 
    586             BufferedReader in = new BufferedReader(new InputStreamReader(httpcon.getInputStream())); 
     588            InputStream is = httpcon.getInputStream(); 
     589            BufferedReader in = new BufferedReader(new InputStreamReader(is)); 
    587590            String decodedString; 
    588591            while ((decodedString = in.readLine()) != null) { 
     
    607610             
    608611        } 
     612        catch (IOException e) { 
     613                System.err.println("Solr core update failed when processing id: " + volume_id + "." + page_id); 
     614            e.printStackTrace(); 
     615        } 
     616 
    609617        catch (Exception e) { 
    610618            e.printStackTrace();