You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by th...@apache.org on 2009/02/17 14:35:32 UTC

svn commit: r745051 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value: BLOBInResource.java BLOBValue.java

Author: thomasm
Date: Tue Feb 17 13:35:32 2009
New Revision: 745051

URL: http://svn.apache.org/viewvc?rev=745051&view=rev
Log:
JCR-1982 Exception root cause is swallowed when creating a BLOB object

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInResource.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBValue.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInResource.java?rev=745051&r1=745050&r2=745051&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInResource.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBInResource.java Tue Feb 17 13:35:32 2009
@@ -65,8 +65,10 @@
             }
             length = fsResource.length();
         } catch (FileSystemException fse) {
-            throw new IOException(fsResource.getPath()
+            IOException e2 = new IOException(fsResource.getPath()
                     + ": Error while creating value: " + fse.toString());
+            e2.initCause(fse);
+            throw e2;
         }
         this.fsResource = fsResource;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBValue.java?rev=745051&r1=745050&r2=745051&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/BLOBValue.java Tue Feb 17 13:35:32 2009
@@ -191,8 +191,10 @@
                         + ": the specified resource does not exist");
             }
         } catch (FileSystemException fse) {
-            throw new IOException(fsResource.getPath()
+            IOException e2 = new IOException(fsResource.getPath()
                     + ": Error while creating value: " + fse.toString());
+            e2.initCause(fse);
+            throw e2;
         }
         // this instance is backed by a resource in the virtual file system
         this.fsResource = fsResource;



Re: svn commit: r745051 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value: BLOBInResource.java BLOBValue.java

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Feb 17, 2009 at 2:55 PM, Thomas Müller <th...@day.com> wrote:
> Hm... Sorry, I should have waited with committing the changes... I didn't
> knew about this class. I will use it in the future (but leave the code right
> now).

Yeah, that's fine. Just wanted to point it out for future use.

BR,

Jukka Zitting

Re: svn commit: r745051 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value: BLOBInResource.java BLOBValue.java

Posted by Thomas Müller <th...@day.com>.
Hi Jukka,

Hm... Sorry, I should have waited with committing the changes... I didn't
knew about this class. I will use it in the future (but leave the code right
now).

Regards,
Thomas


On Tue, Feb 17, 2009 at 2:46 PM, Jukka Zitting <ju...@gmail.com>wrote:

> Hi,
>
> On Tue, Feb 17, 2009 at 2:35 PM,  <th...@apache.org> wrote:
> > -            throw new IOException(fsResource.getPath()
> > +            IOException e2 = new IOException(fsResource.getPath()
> >                     + ": Error while creating value: " + fse.toString());
> > +            e2.initCause(fse);
> > +            throw e2;
>
> There's a nice utility class in Commons IO 1.4 for this purpose. See
> IOExceptionWithCause [1].
>
> [1]
> http://commons.apache.org/io/api-release/org/apache/commons/io/IOExceptionWithCause.html
>
> BR,
>
> Jukka Zitting
>

Re: svn commit: r745051 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value: BLOBInResource.java BLOBValue.java

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Tue, Feb 17, 2009 at 2:35 PM,  <th...@apache.org> wrote:
> -            throw new IOException(fsResource.getPath()
> +            IOException e2 = new IOException(fsResource.getPath()
>                     + ": Error while creating value: " + fse.toString());
> +            e2.initCause(fse);
> +            throw e2;

There's a nice utility class in Commons IO 1.4 for this purpose. See
IOExceptionWithCause [1].

[1] http://commons.apache.org/io/api-release/org/apache/commons/io/IOExceptionWithCause.html

BR,

Jukka Zitting