In case when an empty file is specified instead of image, jimage fails with the following error message:
% jimage info empty_file
java.lang.IllegalArgumentException: newLimit > capacity: (28 > 4)
at java.base/java.nio.Buffer.createLimitException(Buffer.java:367)
at java.base/java.nio.Buffer.limit(Buffer.java:341)
at java.base/java.nio.ByteBuffer.limit(ByteBuffer.java:1094)
at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:230)
at java.base/java.nio.MappedByteBuffer.limit(MappedByteBuffer.java:66)
at java.base/jdk.internal.jimage.BasicImageReader.slice(BasicImageReader.java:203)
at java.base/jdk.internal.jimage.BasicImageReader.intBuffer(BasicImageReader.java:210)
at java.base/jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:147)
at java.base/jdk.internal.jimage.BasicImageReader.open(BasicImageReader.java:173)
at jdk.jlink/jdk.tools.jimage.JImageTask.iterate(JImageTask.java:383)
at jdk.jlink/jdk.tools.jimage.JImageTask.run(JImageTask.java:435)
at jdk.jlink/jdk.tools.jimage.JImageTask.run(JImageTask.java:228)
at jdk.jlink/jdk.tools.jimage.Main.main(Main.java:34)
The issue affects all jimage commands.
Tested on the latest jigsaw and jdk 9-ea+144.