DO NOT REPLY [Bug 35184] New: - Error while loading image http://xxx.xx.x/yyyy.tif : class org.apache.fop.image.TiffImage - length mismatch on read

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

DO NOT REPLY [Bug 35184] New: - Error while loading image http://xxx.xx.x/yyyy.tif : class org.apache.fop.image.TiffImage - length mismatch on read

Bugzilla from bugzilla@apache.org
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG?
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35184>.
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=35184

           Summary: Error while loading image http://xxx.xx.x/yyyy.tif :
                    class org.apache.fop.image.TiffImage - length mismatch
                    on read
           Product: Fop
           Version: 0.20.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: images
        AssignedTo: [hidden email]
        ReportedBy: [hidden email]
                CC: [hidden email]


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");
      }

--
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.