Tapestry
  1. Tapestry
  2. TAPESTRY-1706

Rounded corner service fails with 0 byte image buffer.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.2
    • Fix Version/s: 4.1.3
    • Component/s: Contrib
    • Labels:
      None
    • Environment:
      MacOS X 10.4

      Description

      An image with a background color will fail to be created properly. The problem appears to be in the call to ImageIO.write(), which does not put anything into the byte buffer.

      The following works:

      http://localhost:8080/rounded?c=blue&w=20&h=20&shadow=false&a=tl

      A simple, rounded corner is produced in blue.

      The following fails:

      http://localhost:8080/rounded?c=blue&bc=red&w=20&h=20&shadow=false&a=tl

      The only addition in the failing case is a non-transparent background color. The logged message is the following:

      23:55:17.230 ERROR! [SocketListener0-0] org.apache.tapestry.contrib.services.impl.RoundedCornerService.service(RoundedCornerService.java:138) >42> Image generated had zero length byte array from parameters of:
      [color:blue, bgColor:red, width:20, height:20, angle:tl, shadowWidth:-1, shadowOpacity:-1.0, side:null, wholeShadow: false, arcWidth: -1.0, arcHeight:-1.0
      image: BufferedImage@4ca30b: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 20 height = 20 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0

      Note that if the service code is modified such that the type is forced to PNG, then the second example does render properly (red background and all).

        Activity

        Hide
        Jesse Kuhnert added a comment -

        Gif format isn't supported in the jre platform until ver 1.6 so added logic to detect supported formats and fall back to jpeg when gif isn't available.

        Show
        Jesse Kuhnert added a comment - Gif format isn't supported in the jre platform until ver 1.6 so added logic to detect supported formats and fall back to jpeg when gif isn't available.

          People

          • Assignee:
            Jesse Kuhnert
            Reporter:
            Kevin Menard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development