private CIJob getJob(ApplicationInfo appInfo) throws PhrescoException { Gson gson = new Gson(); try { BufferedReader br = new BufferedReader(new FileReader(getCIJobPath(appInfo))); CIJob job = gson.fromJson(br, CIJob.class); br.close(); return job; } catch (FileNotFoundException e) { S_LOGGER.debug(e.getLocalizedMessage()); return null; } catch (com.google.gson.JsonParseException e) { S_LOGGER.debug("it is already adpted project !!!!! " + e.getLocalizedMessage()); return null; } catch (IOException e) { S_LOGGER.debug(e.getLocalizedMessage()); return null; } }
public @Nonnull Document parseResponse( @Nonnull InputStream responseBodyAsStream, boolean withWireLogging) throws CloudException, InternalException { try { BufferedReader in = new BufferedReader(new InputStreamReader(responseBodyAsStream)); StringBuilder sb = new StringBuilder(); String line; while ((line = in.readLine()) != null) { sb.append(line); sb.append("\n"); } in.close(); return parseResponse(sb.toString(), withWireLogging); } catch (IOException e) { throw new CloudException(e); } }
public List<CIJob> getJobs(ApplicationInfo appInfo) throws PhrescoException { S_LOGGER.debug("GetJobs Called!"); try { boolean adaptedProject = adaptExistingJobs(appInfo); S_LOGGER.debug("Project adapted for new feature => " + adaptedProject); Gson gson = new Gson(); BufferedReader br = new BufferedReader(new FileReader(getCIJobPath(appInfo))); Type type = new TypeToken<List<CIJob>>() {}.getType(); List<CIJob> jobs = gson.fromJson(br, type); br.close(); return jobs; } catch (FileNotFoundException e) { S_LOGGER.debug("FileNotFoundException"); return null; } catch (IOException e) { S_LOGGER.debug("IOException"); throw new PhrescoException(e); } }