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

Code before:

    commonCliOptions.validate();
    SingleThreadedExecutor executor = new SingleThreadedExecutor();
    try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {

      ConsoleLogger logger =
          CliLogger.newLogger(
              commonCliOptions.getVerbosity(),
              commonCliOptions.getConsoleOutput(),
              spec.commandLine().getOut(),
              spec.commandLine().getErr(),
              executor);

      if (!Files.exists(jarFile)) {
        logger.log(LogEvent.Level.ERROR, "The file path provided does not exist: " + jarFile);
        return 1;
      }
      if (Files.isDirectory(jarFile)) {
        logger.log(
            LogEvent.Level.ERROR,
            "The file path provided is for a directory. Please provide a path to a JAR: "
                + jarFile);
        return 1;
      }
      if (!entrypoint.isEmpty() && !jvmFlags.isEmpty()) {
        logger.log(LogEvent.Level.WARN, "--jvm-flag is ignored when --entrypoint is specified");
      }

      JarProcessor processor = JarProcessors.from(jarFile, tempDirectoryProvider, mode);
      JibContainerBuilder containerBuilder =
          JarFiles.toJibContainerBuilder(processor, this, commonCliOptions, logger);
      CacheDirectories cacheDirectories =
          CacheDirectories.from(commonCliOptions, jarFile.toAbsolutePath().getParent());
      Containerizer containerizer = Containerizers.from(commonCliOptions, logger, cacheDirectories);
      containerBuilder.containerize(containerizer);
    } catch (Exception ex) {
      if (commonCliOptions.isStacktrace()) {
        ex.printStackTrace();
      }
      System.err.println(ex.getClass().getName() + ": " + ex.getMessage());
      return 1;
    } finally {
      executor.shutDownAndAwaitTermination(Duration.ofSeconds(3));
    }
    return 0;
  }

  /**
   * Returns the user-specified base image.
   *
   * @return an optional base image

Review comment (suggestion):
```suggestion
        logger.log(LogEvent.Level.WARN, "--jvm-flags is ignored when --entrypoint is specified");
```

Code after:

    commonCliOptions.validate();
    SingleThreadedExecutor executor = new SingleThreadedExecutor();
    try (TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider()) {

      ConsoleLogger logger =
          CliLogger.newLogger(
              commonCliOptions.getVerbosity(),
              commonCliOptions.getConsoleOutput(),
              spec.commandLine().getOut(),
              spec.commandLine().getErr(),
              executor);

      if (!Files.exists(jarFile)) {
        logger.log(LogEvent.Level.ERROR, "The file path provided does not exist: " + jarFile);
        return 1;
      }
      if (Files.isDirectory(jarFile)) {
        logger.log(
            LogEvent.Level.ERROR,
            "The file path provided is for a directory. Please provide a path to a JAR: "
                + jarFile);
        return 1;
      }
      if (!entrypoint.isEmpty() && !jvmFlags.isEmpty()) {
        logger.log(LogEvent.Level.WARN, "--jvm-flags is ignored when --entrypoint is specified");
      }

      JarProcessor processor = JarProcessors.from(jarFile, tempDirectoryProvider, mode);
      JibContainerBuilder containerBuilder =
          JarFiles.toJibContainerBuilder(processor, this, commonCliOptions, logger);
      CacheDirectories cacheDirectories =
          CacheDirectories.from(commonCliOptions, jarFile.toAbsolutePath().getParent());
      Containerizer containerizer = Containerizers.from(commonCliOptions, logger, cacheDirectories);
      containerBuilder.containerize(containerizer);
    } catch (Exception ex) {
      if (commonCliOptions.isStacktrace()) {
        ex.printStackTrace();
      }
      System.err.println(ex.getClass().getName() + ": " + ex.getMessage());
      return 1;
    } finally {
      executor.shutDownAndAwaitTermination(Duration.ofSeconds(3));
    }
    return 0;
  }

  /**
   * Returns the user-specified base image.
   *
   * @return an optional base image