Repository: GoogleContainerTools/jib
File: jib-cli/src/main/java/com/google/cloud/tools/jib/cli/War.java (Java)

Code before:
        return 1;
      }
      if (Files.isDirectory(warFile)) {
        logger.log(
            LogEvent.Level.ERROR,
            "The file path provided is for a directory. Please provide a path to a WAR: "
                + warFile);
        return 1;
      }

      Path warFileParentDir = Verify.verifyNotNull(warFile.toAbsolutePath().getParent());
      CacheDirectories cacheDirectories = CacheDirectories.from(commonCliOptions, warFileParentDir);
      ArtifactProcessor processor =
          ArtifactProcessors.fromWar(
              warFile, cacheDirectories, this, commonContainerConfigCliOptions);
      JibContainerBuilder containerBuilder =
          WarFiles.toJibContainerBuilder(
              processor, commonCliOptions, commonContainerConfigCliOptions, logger);
      Containerizer containerizer = Containerizers.from(commonCliOptions, logger, cacheDirectories);

      // Enable registry mirrors
      Multimaps.asMap(globalConfig.getRegistryMirrors()).forEach(containerizer::addRegistryMirrors);

      JibContainer jibContainer = containerBuilder.containerize(containerizer);
      JibCli.writeImageJson(commonCliOptions.getImageJsonPath(), jibContainer);
    } catch (IOException
        | InvalidImageReferenceException
        | CacheDirectoryCreationException
        | ExecutionException
        | RegistryException
        | InvalidGlobalConfigException ex) {
      JibCli.logTerminatingException(logger, ex, commonCliOptions.isStacktrace());
      return 1;
    } catch (InterruptedException ex) {
      JibCli.logTerminatingException(logger, ex, commonCliOptions.isStacktrace());
      Thread.currentThread().interrupt();
      return 1;
    } finally {
      JibCli.finishUpdateChecker(logger, updateCheckFuture);
      executor.shutDownAndAwaitTermination(Duration.ofSeconds(3));
    }
    return 0;
  }

  /**
   * Returns the user-specified app root in the container.
   *
   * @return a user configured app root
   */
  public Optional<AbsoluteUnixPath> getAppRoot() {
    if (appRoot == null) {

Review comment (suggestion):
Probably, instead of enumerating all these, you can catch `InterruptedException` first and then catch `Exception` later. But this works too. (Need to confirm if this works as intended.)

Code after:
                + warFile);
        return 1;
      }

      Path warFileParentDir = Verify.verifyNotNull(warFile.toAbsolutePath().getParent());
      CacheDirectories cacheDirectories = CacheDirectories.from(commonCliOptions, warFileParentDir);
      ArtifactProcessor processor =
          ArtifactProcessors.fromWar(
              warFile, cacheDirectories, this, commonContainerConfigCliOptions);
      JibContainerBuilder containerBuilder =
          WarFiles.toJibContainerBuilder(
              processor, commonCliOptions, commonContainerConfigCliOptions, logger);
      Containerizer containerizer = Containerizers.from(commonCliOptions, logger, cacheDirectories);

      // Enable registry mirrors
      Multimaps.asMap(globalConfig.getRegistryMirrors()).forEach(containerizer::addRegistryMirrors);

      JibContainer jibContainer = containerBuilder.containerize(containerizer);
      JibCli.writeImageJson(commonCliOptions.getImageJsonPath(), jibContainer);
    } catch (InterruptedException ex) {
      JibCli.logTerminatingException(logger, ex, commonCliOptions.isStacktrace());
      Thread.currentThread().interrupt();
      return 1;
    } catch (Exception ex) {
      JibCli.logTerminatingException(logger, ex, commonCliOptions.isStacktrace());
      return 1;
    } finally {
      JibCli.finishUpdateChecker(logger, updateCheckFuture);
      executor.shutDownAndAwaitTermination(Duration.ofSeconds(3));
    }
    return 0;
  }

  /**
   * Returns the user-specified app root in the container.
   *
   * @return a user configured app root
   */
  public Optional<AbsoluteUnixPath> getAppRoot() {
    if (appRoot == null) {
      return Optional.empty();
    }
    return Optional.of(AbsoluteUnixPath.fromPath(appRoot));
  }
}