Ejemplo n.º 1
0
 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;
   }
 }
Ejemplo n.º 2
0
 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);
   }
 }