[ 
https://issues.apache.org/jira/browse/JCR-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13752183#comment-13752183
 ] 

Thomas Mueller commented on JCR-3652:
-------------------------------------

I think I have a test case now that can reproduce the problem with very simple 
operations (only one workspace):

{code}
    public void testCopyCheckedOut() throws Exception {
        Node root = superuser.getRootNode();
        String nodeName = "testCopyCheckedOut" + System.currentTimeMillis();
        if (root.hasNode(nodeName)) {
            root.getNode(nodeName).remove();
            superuser.save();
        }
        Node test = root.addNode(nodeName);
        Node a = test.addNode("a");
        Node b = test.addNode("b");
        b.addMixin("mix:versionable");
        superuser.save();
        Value v = b.getProperty("jcr:isCheckedOut").getValue();
        try {
            a.setProperty("jcr:isCheckedOut", v);
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("set failed strangely: " + e);
        }
        
System.out.println(a.getProperty("jcr:isCheckedOut").getValue().getString());
        
System.out.println(b.getProperty("jcr:isCheckedOut").getValue().getString());
    }
{code}

This test prints "set failed strangely: 
java.lang.ArrayIndexOutOfBoundsException: 0" and then fails with

{code}
javax.jcr.RepositoryException: property 
/testCopyCheckedOut1377674810028/a/jcr:isCheckedOut: single-valued property 
with no value
        at 
org.apache.jackrabbit.core.PropertyImpl.internalGetValue(PropertyImpl.java:492)
        at 
org.apache.jackrabbit.core.PropertyImpl.getValue(PropertyImpl.java:510)
{code}

This is with my current version of Jackrabbit (that has added checks)
                
> Bundle serialization broken
> ---------------------------
>
>                 Key: JCR-3652
>                 URL: https://issues.apache.org/jira/browse/JCR-3652
>             Project: Jackrabbit Content Repository
>          Issue Type: New Feature
>          Components: jackrabbit-core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>            Priority: Minor
>             Fix For: 2.4.4, 2.7.1
>
>         Attachments: JCR-3652.patch, JCR-3652-test-case.patch
>
>
> I have got a strange case where some node bundle is broken, seemingly because 
> a byte is missing. I can't explain the missing byte, but it is reproducible, 
> meaning that writing the bundles again will break them again. There are 11 
> broken bundles, 10 of them have the size 480 bytes and one is slightly 
> larger. It is always a boolean property value that is missing, always the 
> value for the property jcr:isCheckedOut.
> As a (temporary) solution, and to help analyze what the problem might be, I 
> will create a patch that does the following:
> * When serializing a bundle, check if the byte array can be de-serialized. If 
> not, then try again. Starting with the 3th try, use a slower variant where 
> before and after writing the boolean value the buffer is flushed. I'm aware 
> that ByteArrayOutputStream.flush doesn't do much, but maybe it solves the 
> problem (let's see) if the problem is related to a JVM issue.
> * If de-serializing a bundle fails, check if it's because of a missing 
> boolean property value. If yes, insert the missing byte.
> I have also added some log messages (warning / error) to help analyze the 
> problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to