cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Lundquist (JIRA)" <j...@apache.org>
Subject [jira] Created: (COCOON-2177) ImageOp with requested height & width both zero should be a no-op, instead it throws an exception
Date Tue, 18 Mar 2008 02:16:24 GMT
ImageOp with requested height & width both zero should be a no-op, instead it throws an
exception
-------------------------------------------------------------------------------------------------

                 Key: COCOON-2177
                 URL: https://issues.apache.org/jira/browse/COCOON-2177
             Project: Cocoon
          Issue Type: Bug
          Components: Blocks: ImageOp
    Affects Versions: 2.1.11, 2.1.10, 2.1.9, 2.1.8, 2.1.12-dev (Current SVN), 2.2-dev (Current
SVN)
            Reporter: Mark Lundquist
            Priority: Minor


When the resize height and width are both zero, the resize operation throws:

java.awt.image.ImagingOpException: Unable to invert transform AffineTransform[[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0]]

Note, if COCOON-2169 is fixed, this happens when no height or width parameter is passed from
the sitemap.  In this case, the resize effect should simply pass through the unaltered image...
it should be a "no-op".

The patch is too small to bother attaching, here it is:

===================================================================
--- blocks/cocoon-imageop/cocoon-imageop-impl/src/main/java/org/apache/cocoon/reading/imageop/ResizeOperation.java
   (revision 635771)
+++ blocks/cocoon-imageop/cocoon-imageop-impl/src/main/java/org/apache/cocoon/reading/imageop/ResizeOperation.java
   (working copy)
@@ -57,6 +57,9 @@
         if( ! enabled ) {
             return image;
         }
+        if ( this.width == 0 && this.height == 0 ) {
+            return image;
+        }
         double height = image.getHeight();
         double width = image.getWidth();
         double xScale = this.width / width




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message