[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about serialization
From: |
Ingo Prötel |
Subject: |
Re: question about serialization |
Date: |
Tue, 05 Aug 2003 11:23:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204 |
Hi,
would like to propose a modification to Toms fix. It looks to me as if
all fields of a deserialized object are accessible as well as the
private readObject-Method. Or does the VM reset the Accessible flag?
I think we need to reset the accessible flag after we are done with the
field or method:
private void callReadMethod (Object obj, ObjectStreamClass osc) throws
IOException
{
...
boolean saved = setAccessible(m,true);
m.invoke (obj, args);
setAccessible(m,saved);
...
}
/**
* Sets the accessible flag of theAccessible in a privileged action.
* @param theAccessible
* @param isAccessible
* @return the previous value of theAccessible.isAccessible()
*/
private static boolean setAccessible(final AccessibleObject
theAccessible, boolean isAccessible){
boolean oldValue = theAccessible.isAccessible();
AccessController.doPrivileged(new PrivilegedAction()
{
public Object run()
{
theAccessible.setAccessible(true);
return null;
}
});
return oldValue;
}
--ingo
- Re: question about serialization, David P Grove, 2003/08/03
- Re: question about serialization, Tom Tromey, 2003/08/02
- Re: question about serialization, Bryce McKinlay, 2003/08/04
- Re: question about serialization, Chris Gray, 2003/08/04
- Re: question about serialization, Bryce McKinlay, 2003/08/04
- Re: question about serialization, Chris Gray, 2003/08/04
- Re: question about serialization, Bryce McKinlay, 2003/08/04
- Re: question about serialization, Tom Tromey, 2003/08/04
- Re: question about serialization,
Ingo Prötel <=
- Re: question about serialization, Tom Tromey, 2003/08/05
- Re: question about serialization, Mark Wielaard, 2003/08/05
- Re: question about serialization, Chris Gray, 2003/08/05