class WarAnalyzer extends JarAnalyzer {

  @Override
  public void analyze(final File _file) throws FileAnalysisException {
    try {
      super.analyze(_file);

      // Extract the WAR
      if (this.workDir != null) this.tmpDir = Paths.get(this.workDir.toString(), "war_analysis");
      else {
        try {
          this.tmpDir = java.nio.file.Files.createTempDirectory("war_analysis_");
        } catch (IOException e) {
          throw new IllegalStateException("Unable to create temp directory", e);
        }
      }
      this.jarWriter.extract(this.tmpDir);

      // Add WEB-INF/classes to the classpath
      try {
        JarAnalyzer.insertClasspath(
            Paths.get(this.tmpDir.toString(), "WEB-INF", "classes").toString());
      } catch (Exception e) {
        // No problem at all if instrumentation is not requested.
        // If instrumentation is requested, however, some classes may not compile
        WarAnalyzer.log.error(
            this.toString() + ": Error while updating the classpath: " + e.getMessage());
      }
    } catch (IllegalStateException e) {
      log.error("IllegalStateException when analyzing file [" + _file + "]: " + e.getMessage());
      throw new FileAnalysisException(
          "Error when analyzing file [" + _file + "]: " + e.getMessage(), e);
    } catch (IOException e) {
      log.error("IOException when analyzing file [" + _file + "]: " + e.getMessage());
      throw new FileAnalysisException(
          "Error when analyzing file [" + _file + "]: " + e.getMessage(), e);
    } catch (Exception e) {
      log.error("Exception when analyzing file [" + _file + "]: " + e.getMessage());
      throw new FileAnalysisException(
          "Error when analyzing file [" + _file + "]: " + e.getMessage(), e);
    }
  }

}