pjfanning opened a new pull request, #1297: URL: https://github.com/apache/poi/pull/1297
Last of the `MathUtil.safeDoubleToInt` callers that can be reached with content from a file. `ImageUtils.getResolution` computes `25.4 / HorizontalPixelSize` from the image's ImageIO metadata: a pixel size of `0` (seen in PNGs with a zero `pHYs` chunk) gives infinity and `safeDoubleToInt` threw `IllegalArgumentException` out of `Picture.getImageDimension()` and `Picture.resize()`; a non-numeric value threw `NumberFormatException`. Both now fall back to the default 96 dpi, as a missing value already did. The conversion is factored into a package-private `dpiFromPixelSize(String)` with a unit test covering zero, negative, tiny, `NaN`, `Infinity`, non-numeric, empty and null values. The truncating int conversion is kept as it was, so valid metadata gives the same dpi as before. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
