Skip to content

Commit

Permalink
Fix for TIFFs which report zero as their resolution. This resulted in…
Browse files Browse the repository at this point in the history
… an exception.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/commons/trunk@979567 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jmaerki committed Jul 27, 2010
1 parent 9b028bc commit 845baed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -127,7 +127,10 @@ private ImageInfo createImageInfo(String uri, ImageInputStream in, ImageContext
xRes = fldx.getAsFloat(0);
yRes = fldy.getAsFloat(0);
}
if (unit == 2) {
if (xRes == 0 || yRes == 0) {
//Some TIFFs may report 0 here which would lead to problems
size.setResolution(context.getSourceResolution());
} else if (unit == 2) {
size.setResolution(xRes, yRes); //Inch
} else {
size.setResolution(
Expand Down
3 changes: 3 additions & 0 deletions status.xml
Expand Up @@ -40,6 +40,9 @@
</contexts>
<changes>
<release version="Trunk" date="n/a">
<action context="Code" dev="JM" type="fix">
Fix for TIFFs which report zero as their resolution. This resulted in an exception.
</action>
</release>
<release version="1.4" date="7 July 2010">
<action context="Code" dev="JM" type="fix" fixes-bug="49364" due-to="Julien Aymé">
Expand Down

0 comments on commit 845baed

Please sign in to comment.