Permalink
Browse files

Fix for TIFFs which report zero as their resolution. This resulted in…

… an exception.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/commons/trunk@979567 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 9b028bc commit 845baeda3be00e21c09b5501095f2ab5b1497608 @jmaerki jmaerki committed Jul 27, 2010
Showing with 7 additions and 1 deletion.
  1. +4 −1 src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderTIFF.java
  2. +3 −0 status.xml
@@ -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(
View
@@ -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é">

0 comments on commit 845baed

Please sign in to comment.