Bug 35184 - Error while loading image http://xxx.xx.x/yyyy.tif : class org.apache.fop.image.TiffImage - length mismatch on read
Summary: Error while loading image http://xxx.xx.x/yyyy.tif : class org.apache.fop.ima...
Status: CLOSED WONTFIX
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: 0.20.5
Hardware: Other other
: P3 trivial
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-02 13:53 UTC by Sergey Trapeznikov
Modified: 2012-04-30 00:17 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Trapeznikov 2005-06-02 13:53:38 UTC
When used TIFF image from remote host (via http or ftp) only part of image
readed from inputStream, and error check failed. From local filesystem all works
fine.

/org/apache/fop/image/TiffImage.java  must be modifyed:

Code:

      inputStream = this.m_href.openStream();
      inputStream.skip(offset);
      bytes_read = inputStream.read(readBuf);
      if (bytes_read != length) {
        throw new FopImageException("Error while loading image "
                                    + this.m_href.toString() + " : "
                                    + this.getClass() + " - "
                                    + "length mismatch on read");
      }

      this.m_bitmaps = readBuf;


must be replaced with:

      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      
      try {
        inputStream = this.m_href.openStream();
        inputStream.skip(offset);
        while ( (bytes_read = inputStream.read(readBuf)) != -1) {
          baos.write(readBuf, 0, bytes_read);
        }
      }
      catch (java.io.IOException ex) {
        throw new FopImageException("Error while loading image " +
                                    this.m_href.toString() + " : " +
                                    ex.getClass() +
                                    " - " + ex.getMessage());
      }
      this.m_bitmaps = baos.toByteArray();
      bytes_read = m_bitmaps.length;
      if (bytes_read != length) {
        throw new FopImageException("Error while loading image "
                                    + this.m_href.toString() + " : "
                                    + this.getClass() + " - "
                                    + "length mismatch on read");
      }
Comment 1 Glenn Adams 2012-04-07 01:42:52 UTC
resetting P2 open bugs to P3 pending further review
Comment 2 Glenn Adams 2012-04-07 02:01:26 UTC
source file no longer present in fop
Comment 3 Glenn Adams 2012-04-30 00:14:48 UTC
batch transition resolved+wontfix to closed+wontfix
Comment 4 Glenn Adams 2012-04-30 00:17:17 UTC
batch transition resolved+wontfix to closed+wontfix; if you believe this remains a bug and can demonstrate it with appropriate input FO file and output PDF file (as applicable), then you may reopen