[ 
https://issues.apache.org/jira/browse/WICKET-1445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581823#action_12581823
 ] 

Niclas Hedhman commented on WICKET-1445:
----------------------------------------

Actually, not quite that fast...

IObjectStreamFactory has the weirdest construct....

What on earth's name is this for? And the close() of the patch above will now 
instead be a NPE. 
I think Eelco need to explain himself.

public ObjectOutputStream newObjectOutputStream(final OutputStream out) throws 
IOException
{
    final ObjectOutputStream oos = new ObjectOutputStream(out);
    return new ObjectOutputStream()
    {
        protected void writeObjectOverride(final Object obj) throws IOException
        {
            try
            {
                oos.writeObject(obj);
            }
            catch (IOException e)
            {
                if (SerializableChecker.isAvailable())
                {
                    // trigger serialization again, but this time gather
                    // some more info
                    new 
SerializableChecker((NotSerializableException)e).writeObject(obj);
                    // if we get here, we didn't fail, while we
                    // should;
                    throw e;
                }
                throw e;
            }
            catch (RuntimeException e)
            {
                log.error("error writing object " + obj + ": " + 
e.getMessage(), e);
                throw e;
            }
        }
    };
}


> StreamCorruptedException/PageStore/Serialization broken because 
> ObjectOutputStream was not flushed
> --------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1445
>                 URL: https://issues.apache.org/jira/browse/WICKET-1445
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.1, 1.3.2
>            Reporter: Niclas Hedhman
>            Assignee: Igor Vaynberg
>             Fix For: 1.3.3
>
>         Attachments: wicket-close-stream.patch
>
>
> The Objects.objectToByteArray() method incorrectly forgets to flush/close the 
> ObjectOutputStream it uses. This can create corrupt object streams.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to