Example #1
0
  // fix for 4720897
  // if the jar file resides in a war file, download it to a temp dir
  // so it can be used to generate jardiff
  private String getRealPath(String path) throws IOException {

    URL fileURL = _servletContext.getResource(path);

    File tempDir = (File) _servletContext.getAttribute("javax.servlet.context.tempdir");

    // download file into temp dir
    if (fileURL != null) {
      File newFile = File.createTempFile("temp", ".jar", tempDir);
      if (download(fileURL, newFile)) {
        String filePath = newFile.getPath();
        return filePath;
      }
    }
    return null;
  }