is.close();
    private String getScalingAttr(HttpServletRequest hrq, Bitstream bitstream)            throws JspException    {        BufferedImage buf;        try        {            Context c = UIUtil.obtainContext(hrq);            InputStream is = BitstreamStorageManager.retrieve(c, bitstream                    .getID());            //AuthorizeManager.authorizeAction(bContext, this, Constants.READ);            // 	read in bitstream's image            buf = ImageIO.read(is);        }        catch (SQLException sqle)        {            throw new JspException(sqle.getMessage());        }        catch (IOException ioe)        {            throw new JspException(ioe.getMessage());        }        // now get the image dimensions        float xsize = (float) buf.getWidth(null);        float ysize = (float) buf.getHeight(null);        // scale by x first if needed        if (xsize > (float) thumbItemListMaxWidth)        {            // calculate scaling factor so that xsize * scale = new size (max)            float scale_factor = (float) thumbItemListMaxWidth / xsize;            // now reduce x size and y size            xsize = xsize * scale_factor;            ysize = ysize * scale_factor;        }        // scale by y if needed        if (ysize > (float) thumbItemListMaxHeight)        {            float scale_factor = (float) thumbItemListMaxHeight / ysize;            // now reduce x size            // and y size            xsize = xsize * scale_factor;            ysize = ysize * scale_factor;        }        StringBuffer sb = new StringBuffer("width=\"").append(xsize).append(                "\" height=\"").append(ysize).append("\"");        return sb.toString();    }