JDK-8173853 : IllegalArgumentException in java.awt.image.ReplicateScaleFilter
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u131,8,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-02-02
  • Updated: 2017-12-21
  • Resolved: 2017-03-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 7 JDK 8 JDK 9 Other
10Fixed 7u161Fixed 8u152Fixed 9 b163Fixed openjdk7uFixed
For a Java appliction on Debian GNU/Linux 8 (OS) on Linux mde 4.7.5 (kernel)
with JRE 1.7.0_121-b31, the application crashes when restarting the
application without restarting the device. The following exception is thrown
when setting javax.swing.jcomponent cursor:

java.lang.IllegalArgumentException: Width (0) and height (0) must be non-zero
                at java.awt.Image.getScaledInstance(Image.java:173)
                at sun.awt.CustomCursor.<init>(CustomCursor.java:69)
                at sun.awt.X11CustomCursor.<init>(X11CustomCursor.java:43)
                at sun.awt.X11.XCustomCursor.<init>(XCustomCursor.java:42)

Please push the fix by 3/16 end-of-the-day

The same code is present in jdk8u and jdk9. So I believe the problem is reproducible there, as well.

It was technically proved (via FVB) that proposed fix resolved the problem for jdk7u

Problem description: Sometimes XQueryBestCursor may return zero-dimension to the code inside XCustomCursor.getBestCursorSize(). As a result the subsequent invocation of CustomCursor constructor will fail wit IllegalArgumentException during scaling of the image. Suggested fix: It is necessary to avoid scaling if getBestCursorSize() returns zero-dimension.