Author: ron.sigal(a)jboss.com
Date: 2008-04-04 03:43:10 -0400 (Fri, 04 Apr 2008)
New Revision: 3887
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
Log:
JBREM-934: Put JBossSerialization operations in AccessController.doPrivileged() call.
Modified: remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04
07:40:51 UTC (rev 3886)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/callback/CallbackStore.java 2008-04-04
07:43:10 UTC (rev 3887)
@@ -443,7 +443,7 @@
* @param object
* @throws IOException
*/
- public void add(Serializable object) throws IOException
+ public void add(final Serializable object) throws IOException
{
verifyStarted();
@@ -485,10 +485,34 @@
{
throw (IOException) e.getCause();
}
-
- out =
SerializationStreamFactory.getManagerInstance(serializationType).createOutput(outFile);
- out.writeObject(object);
- out.flush();
+
+ if (serializationType.indexOf("jboss") > 0)
+ {
+ out =
SerializationStreamFactory.getManagerInstance(serializationType).createOutput(outFile);
+ out.writeObject(object);
+ out.flush();
+ }
+ else
+ {
+ try
+ {
+ final FileOutputStream finalOutFile = outFile;
+ out = (ObjectOutputStream) AccessController.doPrivileged( new
PrivilegedExceptionAction()
+ {
+ public Object run() throws IOException
+ {
+ ObjectOutputStream out =
SerializationStreamFactory.getManagerInstance(serializationType).createOutput(finalOutFile);
+ out.writeObject(object);
+ out.flush();
+ return out;
+ }
+ });
+ }
+ catch (PrivilegedActionException e)
+ {
+ throw (IOException) e.getCause();
+ }
+ }
}
finally
{
Show replies by date