ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Meindert" <meind...@pastelebusiness.com>
Subject RE: Problem with blob
Date Tue, 14 Aug 2007 06:44:49 GMT
Hi Vanessa,

Sorry if I'm wrong (I don't work with blogs)
But I would think that the byteread object you think you set with the line 
public byte[] byteread = new byte[65000];
will be overridden by
byteread = ((model.StudentHtml)resultList.get(0)).getAttest();
and a new byte array with the size 59056 would be created

I don't see in your code the place where the IndexOutOfBoundsException
would be thrown?

Kind Regards
 Meindert

-----Original Message-----
From: Vanessa [mailto:vanessabossens@telenet.be] 
Sent: 14 August 2007 08:36 AM
To: user-java@ibatis.apache.org
Subject: Problem with blob

Hello everyone

I have the next problem what I cannot solve.
I have a web application that displays blobs to the users.
I have written the code myself and when I execute it, I get an ERROR 500.
java.lang.IndexOutOfBoundsException
The problem is, when I have for example 20 blobs that the users can see, al
the blobs that are stock in the database with length 65000 are displayed and
the one with 59056 gives the ERROR 500 java.lang.IndexOutOfBoundsException
error.

This is the code I have developed for displaying the blob: 


public byte[] byteread = new byte[65000];

public boolean readStudentHtml(String key) throws Exception {

    try {
	Etc..

      If Etc. {
        for Etc..  {

        Object currentBlob =
((model.StudentHtml)resultList.get(i)).getAttest();
          if (currentBlob != null) {
            byteread = ((model.StudentHtml)resultList.get(0)).getAttest();
            logger.trace("Blob found for : " + key);
            return true;
          } else {
            logger.error("Blob not found for : " + key);
            return false;
          }
        }
        } else {
          logger.error("Blob not found for : " + key);
      }
    } catch (Exception e) {
      logger.trace("Error readStudentHtml : Cause : " + e);
      e.printStackTrace();
    }
    return false;
  }


Can someone help me.
Vanessa




Mime
View raw message