コード例 #1
0
 private static void logException(XTriggerLog xTriggerLog, Exception e) {
   e.printStackTrace();
   xTriggerLog.error(e.getMessage());
   for (StackTraceElement se : e.getStackTrace()) {
     xTriggerLog.error(se.toString());
   }
 }
コード例 #2
0
ファイル: NugetUpdater.java プロジェクト: hagzag/nuget-plugin
 public boolean performUpdate() {
   // String solutionGlob = "glob:" + file.getAbsolutePath() + "\\*.sln";
   try {
     checkVersions();
   } catch (Throwable ex) {
     log.error(ex.toString());
     return false;
   }
   return updated;
 }
コード例 #3
0
ファイル: NugetUpdater.java プロジェクト: hagzag/nuget-plugin
  private String getPackageVersion(String wsRoot, String id) throws IOException {
    String line;

    if (packages.containsKey(id)) {
      return packages.get(id);
    }

    String nuget =
        new File(nugetExe).isAbsolute() ? nugetExe : new File(wsRoot, nugetExe).getAbsolutePath();

    String cmd = String.format("\"%s\" list %s -NonInteractive", nuget, id);
    for (int retried = 0; retried < retryCount; retried++) {
      log.info(String.format("Running: %s", cmd));
      Process p = Runtime.getRuntime().exec(cmd);
      BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream()));
      BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
      while ((line = stdout.readLine()) != null) {
        log.info(line);
        String[] parts = line.split(" ", 2);
        if (parts.length == 2 && parts[0].equalsIgnoreCase(id)) {
          packages.put(id, parts[1]);
          return parts[1];
        }
      }
      stdout.close();
      while ((line = stderr.readLine()) != null) {
        log.error(line);
      }
      stderr.close();
      try {
        p.waitFor();
        break;
      } catch (InterruptedException ex) {
        log.error(ex.toString());
        log.info(String.format("Retrying: %i", retried));
      }
    }
    return null;
  }