Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1.  
  2.  
  3. logger.info("Bundle updated");
  4.  
  5. // Declaration
  6. BufferedReader br = null;
  7. FileReader fr = null;
  8. String filePath = "";
  9. String exitFile = "";
  10.  
  11. filePath = properties.get(Constants.PATH_FILE).toString();
  12. logger.warn(filePath);
  13. try {
  14.  
  15. fr = new FileReader(filePath);
  16. br = new BufferedReader(fr);
  17.  
  18. String[] fileLine, headerLine;
  19. String currentLine;
  20. JSONObject exitJson = new JSONObject();
  21.  
  22. headerLine = br.readLine().split(CSV_SEPARATOR);
  23.  
  24. while ((currentLine = br.readLine()) != null) {
  25.  
  26. fileLine = currentLine.split(CSV_SEPARATOR);
  27.  
  28. for (int i = 0; i < headerLine.length; i++) {
  29.  
  30. exitJson.put(headerLine[i], fileLine[i]);
  31. logger.warn(fileLine[i]);
  32. }
  33. exitFile = exitJson.toString();
  34. logger.info("JSON_PRODOTTO" + exitFile);
  35.  
  36. }
  37.  
  38. // exitFile = exitJson.toString();
  39.  
  40. } catch (FileNotFoundException e) {
  41.  
  42. // Execute Log
  43. // e.printStackTrace();
  44. logger.error(e.toString());
  45.  
  46. } catch (IOException e) {
  47.  
  48. // Execute Log
  49. // e.printStackTrace();
  50. logger.error(e.toString());
  51.  
  52. } catch (JSONException e) {
  53.  
  54. // Execute Log
  55. // e.printStackTrace();
  56. logger.error(e.toString());
  57.  
  58. }
  59.  
  60. // logger.info(exitFile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement