harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject ObjectInputStream#registerInvalidation should check the call is in readObject (was Re: [jira] Updated: (HARMONY-3916) [classlib][io] Harmony throws unexpected NotActiveException when there's a ObjectInputValidation registered)
Date Mon, 21 May 2007 08:09:49 GMT
Hi,

As spec requires, ObjectInputStream#registerInvalidation throws
NotActiveException if it's called from the outside. Our old code only
checkes whether the currentObject is null, which might happen in the
recursive readObject() call. So I think check "nestedCallLevel" is necessary
too. Would any committer verify and apply this patch?

ps: on my clean workspace, there're some intermittent failures before
applying this patch. so I'm only 99% sure that this patch doesn't break
anything.  Thanks!

On 5/21/07, Andrew Zhang (JIRA) <jira@apache.org> wrote:
>
>
>      [
> https://issues.apache.org/jira/browse/HARMONY-3916?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Andrew Zhang updated HARMONY-3916:
> ----------------------------------
>
>     Attachment: Harmony-3916.diff
>
> Hi,
>
> Would you please apply my patch? Thanks!
>
> Best regards,
> Andrew
>
> > [classlib][io] Harmony throws unexpected NotActiveException when there's
> a ObjectInputValidation registered
> >
> ------------------------------------------------------------------------------------------------------------
> >
> >                 Key: HARMONY-3916
> >                 URL: https://issues.apache.org/jira/browse/HARMONY-3916
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: Classlib
> >            Reporter: Andrew Zhang
> >         Attachments: Harmony-3916.diff
> >
> >
> > Following test case reproduces the problem:
> > public void test() throws Exception {
> >        ByteArrayOutputStream baos = new ByteArrayOutputStream();
> >         ObjectOutputStream oos = new ObjectOutputStream(baos);
> >         oos.writeObject(new RegisterValidationClass());
> >         oos.close();
> >         ByteArrayInputStream bais = new ByteArrayInputStream(
> baos.toByteArray());
> >         ObjectInputStream fis = new ObjectInputStream(bais);
> >         // should not throw NotActiveException
> >         fis.readObject();
> >     }
> >
> >     private static class RegisterValidationClass implements Serializable
> {
> >         private A a = new A();
> >         private void readObject(ObjectInputStream stream) throws
> IOException, ClassNotFoundException {
> >             stream.defaultReadObject();
> >             stream.registerValidation(new MockObjectInputValidation(),
> 0);
> >         }
> >     }
> >
> >     private static class MockObjectInputValidation implements
> ObjectInputValidation {
> >         public void validateObject() throws InvalidObjectException {
> >
> >         }
> >     }
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
Best regards,
Andrew Zhang

http://zhanghuangzhu.blogspot.com/

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message