jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-428) Constructor org.apache.jackrabbit.core.value.BLOBFileValue(InputStream in) does not initialize field 'temp' correctly.
Date Wed, 10 May 2006 14:13:05 GMT
    [ http://issues.apache.org/jira/browse/JCR-428?page=comments#action_12378926 ] 

Stefan Guggisberg commented on JCR-428:
---------------------------------------

> I think the bug ist that BLOBFileValue is reused after discard ist called. 
> Discard erases the field buffer or the file. At the point of resue this leads 
> to a empty property not matching the correct value of the property. 

where in jackrabbit's code are BLOBFileValue instances reused after they 
have been discarded? 

what's the exact issue here? are there any jcr api calls that fail?

please provide a simple test case that, using the default configuration,
i.e. DerbyPersistenceManager, demonstrates  the issue.

> Constructor org.apache.jackrabbit.core.value.BLOBFileValue(InputStream in) does not initialize
field 'temp' correctly.
> ----------------------------------------------------------------------------------------------------------------------
>
>          Key: JCR-428
>          URL: http://issues.apache.org/jira/browse/JCR-428
>      Project: Jackrabbit
>         Type: Bug

>   Components: core
>     Versions: 1.0
>     Reporter: Michael Frericks
>     Assignee: Stefan Guggisberg

>
> Situation:
> if the internal value of a property of type binary is created by the constructor BLOBFileValue(InputStream
in) and the content is not stored in an temp-file, then calling the methods 
> a) #setProperty(InputStream in) on this node and then
> b) #refresh(false) on the node of this property 
> on the node of this property leads to an internal value of this property with an erased
byte[].
> Solution:
> Only if the spoolFile is created the field 'temp' should be set to true.
> If the InputStream is stored in the byte[] the field 'temp' should be set to false.
> Patch:
> Index: BLOBFileValue.java
> ===================================================================
> retrieving revision 1.1
> diff -u -r1.1 BLOBFileValue.java
> --- BLOBFileValue.java	8 May 2006 13:57:49 -0000	1.1
> +++ BLOBFileValue.java	8 May 2006 15:19:54 -0000
> @@ -142,6 +142,7 @@
>                      len += read;
>                  }
>              }
> +            in.close();
>          } finally {
>              if (out != null) {
>                  out.close();
> @@ -151,8 +152,15 @@
>          // init vars
>          file = spoolFile;
>          fsResource = null;
> -        // this instance is backed by a temporarily allocated resource/buffer
> -        temp = true;
> +        if (file != null)
> +        {
> +            // this instance is backed by a temporarily allocated resource
> +            temp = true;
> +        }
> +        else
> +        {
> +            temp = true;
> +        }
>      }
>  
>      /**

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message