Return-Path: Delivered-To: apmail-xmlgraphics-general-archive@www.apache.org Received: (qmail 91765 invoked from network); 30 Jul 2007 10:05:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jul 2007 10:05:25 -0000 Received: (qmail 52712 invoked by uid 500); 30 Jul 2007 10:05:25 -0000 Mailing-List: contact general-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@xmlgraphics.apache.org Delivered-To: mailing list general@xmlgraphics.apache.org Received: (qmail 52701 invoked by uid 99); 30 Jul 2007 10:05:25 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2007 03:05:25 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jul 2007 10:05:24 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id 3A7777141F6; Mon, 30 Jul 2007 03:05:03 -0700 (PDT) From: bugzilla@apache.org To: general@xmlgraphics.apache.org Subject: DO NOT REPLY [Bug 42998] New: - NullPointerException in TiffImageWriter if JPEG is chosen for compression Message-ID: X-Bugzilla-Reason: AssignedTo Date: Mon, 30 Jul 2007 03:05:03 -0700 (PDT) X-Virus-Checked: Checked by ClamAV on apache.org DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=42998 Summary: NullPointerException in TiffImageWriter if JPEG is chosen for compression Product: XMLGraphicsCommons Version: 1.2 Platform: Other OS/Version: other Status: NEW Severity: major Priority: P2 Component: ImageWriter AssignedTo: general@xmlgraphics.apache.org ReportedBy: mark.vollmann@opentext.com The following snippet does not work because the parameters are not created correctly. To be precise: 1. Define imageParameters with "JPEG" set as encoding 2. TiffImageWriter#createTIFFEncodeParams(lines 60++) will NOT call setJPEGEncodeParam 3. Eventually TiffImageEncoder gets called and in line 467ff a call to TIFFEncodeParam#getJPEGEncodeParam() is done, which returns null => NPE in line 472 int maxSubH = jep.getHorizontalSubsampling(0); The whole class TiffImageWriter seems untested because if i look at the source i see in line 46 the method public void writeImage(RenderedImage image, OutputStream out) which passes null to as ImageWriterParams to 54:public void writeImage(RenderedImage image, OutputStream out,ImageWriterParams params) throws IOException , which in turn passed null to 61: private TIFFEncodeParam createTIFFEncodeParams(ImageWriterParams params). First statement in that method is if (params.getCompressionMethod() == null) , so you will get NPE here too... org.apache.xmlgraphics.image.writer.ImageWriter imageWriter = new TIFFImageWriter(); MultiImageWriter writer = null; try { writer = imageWriter.createMultiImageWriter(stream); // retrieve writer if (imageWriter != null) { log.info("get image writers parameters"); ImageWriterParams iwp = new ImageWriterParams(); iwp.setCompressionMethod("JPEG"); iwp.setJPEGQuality(compressionQuality, true); iwp.setResolution(param.getDpi()); log.info("render pages"); for (int pageNumber = fromPageNumber; pageNumber <= toPageNumber; pageNumber++) { BufferedImage image; // do stuff to create image log.info("write image"); writer.writeImage(image, iwp); } } catch... finally writer.close() -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- Apache XML Graphics Project URL: http://xmlgraphics.apache.org/ To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: general-help@xmlgraphics.apache.org