paketo-buildpacks/libjvm

Java memory-calculator will fail if you have a directory with a ".jar" extension

Closed this issue · 0 comments

What happened?

  • What were you attempting to do?

Run an app image.

  • What was the actual behavior? Please provide log output, if possible.
C:\projects\monetka-app>docker run docker.io/library/monetka-app:0.0.1-SNAPSHOT
Setting Active Processor Count to 6
unable to determine class count
unable to walk /workspace
unable to open ZIP /workspace/META-INF/licenses/client-2.1.jar
read /workspace/META-INF/licenses/client-2.1.jar: is a directory
ERROR: failed to launch: exec.d: failed to execute exec.d file at path '/layers/paketo-buildpacks_bellsoft-liberica/helper/exec.d/memory-calculator': exit status 1

Classes does not seem to take into account the actual file type, it just looks at the extension. If you name a folder foo.jar it'll try to process it as a JAR file, which fails because you cannot unzip a directory.

I could see the following two checks being helpful:

  1. Check that the file is actually a file, not a directory.

2a. Check that the file is actually a zip file before trying to extract it.

or

2b. Check the error. If it's complaining that the file is not a zip, ignore the error and continue on.

Checklist

  • I have included log output.
  • The log output includes an error message.
  • I have included steps for reproduction.