Bugs item #990243, was opened at 2004-07-13 15:51
Message generated for change (Comment added) made by mikezzz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=990243&group_id=22866

Category: JBossCMP
Group: v3.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Barker (mikezzz)
Assigned to: Alexey Loubyansky (loubyansky)
Summary: CMP does not handle NULL data in IMAGE fields (MS SQL)

Initial Comment:
If you use a IMAGE field on MS SQL Server 2000
(JDBCType=LONGVARBINARY), CMP will fail to create the
CMP entity with will the following exception:

16:28:31,597 ERROR [LogInterceptor] EJBException, causedBy:
java.sql.SQLException: Unable to load to deserialize
result: java.io.StreamCorruptedException: invalid
stream header
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.convertToObject(JDBCUtil.java:293)
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.access$600(JDBCUtil.java:55)
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil$7.readResult(JDBCUtil.java:645)
        at
org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil$AbstractResultSetReader.get(JDBCUtil.java:402)
...

Simple work around is put an empty piece of data in the
offending IMAGE field within the ejbCreate method of
the entity bean (e.g. empty byte[] array).

Below is a patch that would possibly fix the issue (not
tested):

---
D:\cvs\jboss\jboss-3.2.5-src\server\src\main\org\jboss\ejb\plugins\cmp\jdbc\JDBCUtil.java
  Mon Apr 05 10:32:20 2004

+++ JDBCUtil.java       Tue Jul 13 16:40:18 2004
@@ -635,7 +635,7 @@
       {
          Object value = null;
          InputStream binaryData =
rs.getBinaryStream(index);
-         if(binaryData != null)
+         if(binaryData != null && !rs.wasNull())
          {
             try
             {



----------------------------------------------------------------------

>Comment By: Michael Barker (mikezzz)
Date: 2004-07-14 09:00

Message:
Logged In: YES 
user_id=659570

I have attached a patch implemented, using the requested
ResultSetReader interface.  I could not find the specfied
interface in the 3.2.5 released source or the latest in
head, therefore I added the interface myself and made sure
it compiles.  I have not tested it though.  I also had to
change the visibility on some of the JDBCUtil static methods.

----------------------------------------------------------------------

Comment By: Alexey Loubyansky (loubyansky)
Date: 2004-07-13 19:05

Message:
Logged In: YES 
user_id=543482

Could you provide a patch as JDBCResultSetReader implementation?
http://www.jboss.org/wiki/Wiki.jsp?page=CMPParamSettersResultReaders

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=990243&group_id=22866


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to