pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: matrixx <matrixx@freenet.de>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: NPE in BlobInputStream
Date: Sun, 26 Nov 2006 23:21:34 +0100
Message-ID: <456A136E.80704@freenet.de> (raw)
In-Reply-To: <Pine.BSO.4.64.0611260628100.2107@leary2.csoft.net>
References: <45674071.1060509@freenet.de>
	<Pine.BSO.4.64.0611260628100.2107@leary2.csoft.net>

Kris Jurka schrieb:
> 
> 
> On Fri, 24 Nov 2006, matrixx wrote:
> 
>> im using the postgresql-8.1-407.jdbc3.jar driver over hibernate 3 to 
>> access databases.
>>
>> Our application currently runs with mysql and mssql drivers without 
>> any problems. With the postgresql driver i get the following exception:
>>
>> [ModuleProfile.deserialize@AWT-EventQueue-0] ERROR: Error 
>> deserializing blob.
>> java.lang.NullPointerException
>>     at 
>> org.postgresql.largeobject.BlobInputStream.close(BlobInputStream.java:115) 
>>
>>     at java.beans.XMLDecoder.close(XMLDecoder.java:152)
>>     ...
>>
>> I dont know if its a driver bug, or a hibernate issue.
>>
> 
> It's a driver bug that's caused by one of two possible issues.  It's 
> impossible to tell which from this stacktrace alone.
> 
> 1) The BlobInputStream is violating the contract of the close method 
> that allows you to call it more than once.
> 
> 2) You've called getInputStream more than once on a Blob and it can't 
> handle two streams simultaneously.
> 
> I've produced a fix for 1 and a very simple version of 2.  Could you try 
> out this jar file and let me know if it works:
> 

building the 8.1_407 failed cause i'm using jdk1.6.
But i was able to apply and build the patch on 8.2devel.

The NPE is gone there.

The getBinaryStream() is called only once from my side.
The code for accessing the blob simply is:

  ...
  InputStream is = blob.getBinaryStream();
  XMLDecoder decoder = new XMLDecoder(is);
  config = (ModuleProfile) decoder.readObject();
  decoder.close();
  ...

(The blob is from a Hibernate data object).

JR



view thread (4+ messages)  latest in thread

Message-ID: <456A136E.80704@freenet.de>
Permalink:  ../456A136E.80704@freenet.de/
Also on:    postgresql.org/message-id/456A136E.80704@freenet.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: matrixx@freenet.de, books@ejurka.com
  Subject: Re: NPE in BlobInputStream
  In-Reply-To: <456A136E.80704@freenet.de>
  References: <45674071.1060509@freenet.de> <Pine.BSO.4.64.0611260628100.2107@leary2.csoft.net> <456A136E.80704@freenet.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox