ImageUtilities may setup a partially initialized ImageLayout which may result into an IllegalArgumentException

Description

ImageUtilities.getRenderingHints method may setup a partially initialized ImageLayout when dealing with TileSizes computations.

As an instance, it may setup a tileWidth > 0 but keep the tileHeight uninitialized ( = 0).
As soon as an ImageLayout constructor is called on top of a reference ImageLayout via getTile*** getters, this exception is thrown:
Caused by: java.lang.IllegalArgumentException: The specified dimensional parameter is non-positive

something like:

refLayout = ImageUtilities.getImageLayout(...);
imageLayout2 = new ImageLayout(
refLayout.getTileGridXOffset(null),
refLayout.getTileGridYOffset(null),
refLayout.getTileWidth(null),
refLayout.getTileHeight(null),
sm,
cm);

Wouldn't be better if the utility method setting up the tileSize properties will set all of them?

Environment

None

Status

Assignee

Daniele Romagnoli

Reporter

Daniele Romagnoli

Triage

None

Components

Fix versions

Affects versions

21.2

Priority

Medium