JDK-8048583 : CustomMediaSizeName class matching to standard media is too loose
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-06-27
  • Updated: 2015-01-21
  • Resolved: 2014-07-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 8 JDK 9
8u40Fixed 9 b26Fixed
Description
When a printer reports paper sizes CustomMediSizeName tries to match the reported size
to one of the standard paper sizes such as "A4" that are defined
in the javax.print.attribute.standard/MediaSize class and associated classes.
This is then available as CustomMediSizeName.getStandardMedia()

MediaSize,findMedia(..) is used to locate the matching standard media.
We use whatever it returns which is wrong. It will try to find
the closest paper, returning null only when the size we have
is radically different. So often we end up matching a media with
an inappropriate size. Instead we should consider it completely
custom.

If the sizes are not really close we should not report that it
matches a standard media.

This only affects CUPS printing as that is the only code path
that uses  CustomMediSizeName.getStandardMedia()