Mercurial > hg > digilib-old
diff servlet/src/digilib/image/ImageJobDescription.java @ 819:a23c4c15a6a8 stream
clean up possible resource leaks. better behaviour with unknown image types.
author | robcast |
---|---|
date | Mon, 21 Feb 2011 22:36:35 +0100 |
parents | 4568e539abd2 |
children | a630d0303cce |
line wrap: on
line diff
--- a/servlet/src/digilib/image/ImageJobDescription.java Mon Feb 21 10:24:48 2011 +0100 +++ b/servlet/src/digilib/image/ImageJobDescription.java Mon Feb 21 22:36:35 2011 +0100 @@ -166,11 +166,12 @@ input = imageSet.getBiggest(); } } - logger.info("Planning to load: " + input); + if (input == null || input.getMimetype() == null) { + throw new FileOpException("Unable to load "+input); + } + logger.info("Planning to load: " + input); } - return input; - } /** Returns the DocuDirectory for the input (file). @@ -503,33 +504,27 @@ || hasOption("rawfile"); } - /** - * Returns if the image can be sent without processing. Takes image type and - * additional image operations into account. Does not check requested size - * transformation. - * - * @return - * @throws IOException - */ - public boolean isImageSendable() throws IOException { - // cached result? - if (imageSendable == null) { - String mimeType = getMimeType(); - imageSendable = ( (mimeType.equals("image/jpeg") - || mimeType.equals("image/png") - || mimeType.equals("image/gif") ) - && - !(hasOption("hmir") - || hasOption("vmir") - || (getAsFloat("rot") != 0.0) - || (getRGBM() != null) - || (getRGBA() != null) - || (getAsFloat("cont") != 0.0) - || (getAsFloat("brgt") != 0.0))); - } - - return imageSendable; - } + /** + * Returns if the image can be sent without processing. Takes image type and + * additional image operations into account. Does not check requested size + * transformation. + * + * @return + * @throws IOException + */ + public boolean isImageSendable() throws IOException { + if (imageSendable == null) { + String mimeType = getMimeType(); + imageSendable = (mimeType != null + && (mimeType.equals("image/jpeg") || mimeType.equals("image/png") + || mimeType.equals("image/gif")) + && !(hasOption("hmir") + || hasOption("vmir") || (getAsFloat("rot") != 0.0) + || (getRGBM() != null) || (getRGBA() != null) + || (getAsFloat("cont") != 0.0) || (getAsFloat("brgt") != 0.0))); + } + return imageSendable; + } /**