public InputStream getResourceStream(String name) throws ResourceNotFoundException {
   // The following code assumes File.separator is a single character.
   if (File.separator.length() > 1) throw new Error("File.separator length is greater than 1");
   String realName = name.replace('#', File.separator.charAt(0));
   try {
     return new FileInputStream(getSourceDirectory() + File.separator + realName);
   } catch (FileNotFoundException ex) {
     throw new ResourceNotFoundException(
         ex.getLocalizedMessage() + ": " + getSourceDirectory() + File.separator + realName);
   }
 }
Ejemplo n.º 2
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;
   }
 }