Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 4688A9FB1DF for ; Sun, 26 Nov 2006 18:22:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 53721-08 for ; Sun, 26 Nov 2006 18:22:04 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mout0.freenet.de (mout0.freenet.de [194.97.50.131]) by postgresql.org (Postfix) with ESMTP id B5CE09FA430 for ; Sun, 26 Nov 2006 18:22:04 -0400 (AST) Received: from [194.97.55.242] (helo=mx9.freenet.de) by mout0.freenet.de with esmtpa (Exim 4.62) (envelope-from ) id 1GoSNY-00051B-ET; Sun, 26 Nov 2006 23:21:40 +0100 Received: from p54b99ad6.dip0.t-ipconnect.de ([84.185.154.214]:64614 helo=[192.168.181.21]) by mx9.freenet.de with esmtpsa (ID matrixx@freenet.de) (TLSv1:AES256-SHA:256) (port 25) (Exim 4.62 #12) id 1GoSNY-00045o-7T; Sun, 26 Nov 2006 23:21:40 +0100 Message-ID: <456A136E.80704@freenet.de> Date: Sun, 26 Nov 2006 23:21:34 +0100 From: matrixx User-Agent: Thunderbird 1.5.0.8 (X11/20061107) MIME-Version: 1.0 To: Kris Jurka CC: pgsql-jdbc@postgresql.org Subject: Re: NPE in BlobInputStream References: <45674071.1060509@freenet.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/124 X-Sequence-Number: 16166 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