# HG changeset patch # User robcast # Date 1127842648 -7200 # Node ID 25095f85ba7cbe5c244f1418b373082e7481f1cf # Parent 5ded9e06cd5713e4acbad117c0b3dce0eabf77e7 Servlet version 1.5.9c - (hopefully) fixed problem with digilib 1.5.9b stopping after a day... diff -r 5ded9e06cd57 -r 25095f85ba7c servlet/src/digilib/image/ImageLoaderDocuImage.java --- a/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Sep 14 21:59:07 2005 +0200 +++ b/servlet/src/digilib/image/ImageLoaderDocuImage.java Tue Sep 27 19:37:28 2005 +0200 @@ -193,10 +193,11 @@ public void writeImage(String mt, OutputStream ostream) throws FileOpException { logger.debug("writeImage"); + // setup output + ImageWriter writer = null; + ImageOutputStream imgout = null; try { - // setup output - ImageWriter writer = null; - ImageOutputStream imgout = ImageIO.createImageOutputStream(ostream); + imgout = ImageIO.createImageOutputStream(ostream); if (mt == "image/jpeg") { /* * JPEG doesn't do transparency so we have to convert any RGBA @@ -221,13 +222,7 @@ ImageWriteParam param = writer.getDefaultWriteParam(); if (quality > 1) { // change JPEG compression quality - if (param.getCompressionMode() != ImageWriteParam.MODE_EXPLICIT) { - // work around problem with J2RE 1.4 JPEG writer - logger.debug("creating new ImageWriteParam"); - param = new CompressibleJPEGImageWriteParam(param - .getLocale()); - param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); - } + param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); logger.debug("JPEG qual before: " + Float.toString(param.getCompressionQuality())); param.setCompressionQuality(0.9f); @@ -255,6 +250,11 @@ } catch (IOException e) { throw new FileOpException("Error writing image."); + } finally { + // clean up + if (writer != null) { + writer.dispose(); + } } } @@ -506,25 +506,4 @@ img = null; } - /** - * Modified JPEGImageWriteParam that accepts a compression quality to work - * around problem with J2RE 1.4. - * - * @author casties - * - */ - public class CompressibleJPEGImageWriteParam extends JPEGImageWriteParam { - - public CompressibleJPEGImageWriteParam(Locale arg0) { - super(arg0); - // TODO Auto-generated constructor stub - } - - public void setCompressionQuality(float quality) { - if (quality < 0.0F || quality > 1.0F) { - throw new IllegalArgumentException("Quality out-of-bounds!"); - } - this.compressionQuality = quality; - } - } } diff -r 5ded9e06cd57 -r 25095f85ba7c servlet/src/digilib/servlet/Scaler.java --- a/servlet/src/digilib/servlet/Scaler.java Wed Sep 14 21:59:07 2005 +0200 +++ b/servlet/src/digilib/servlet/Scaler.java Tue Sep 27 19:37:28 2005 +0200 @@ -59,7 +59,7 @@ private static final long serialVersionUID = -325080527268912852L; /** digilib servlet version (for all components) */ - public static final String dlVersion = "1.5.9b"; + public static final String dlVersion = "1.5.9c"; /** logger for accounting requests */ private static Logger accountlog = Logger.getLogger("account.request");