[jboss-cvs] JBossAS SVN: r68368 - projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 18 01:36:35 EST 2007


Author: scott.stark at jboss.org
Date: 2007-12-18 01:36:35 -0500 (Tue, 18 Dec 2007)
New Revision: 68368

Modified:
   projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DefaultFieldsImpl.java
Log:
implement read/writeObject to exclude PROPERTY_INFO from being serialized

Modified: projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DefaultFieldsImpl.java
===================================================================
--- projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DefaultFieldsImpl.java	2007-12-18 05:58:06 UTC (rev 68367)
+++ projects/microcontainer/trunk/managed/src/main/org/jboss/managed/plugins/DefaultFieldsImpl.java	2007-12-18 06:36:35 UTC (rev 68368)
@@ -41,6 +41,8 @@
 public class DefaultFieldsImpl
    implements Fields
 {
+   private static String END_MARKER = "__END_OF_FIELDS__";
+
    /** The serialVersionUID */
    private static final long serialVersionUID = 1;
 
@@ -288,19 +290,41 @@
       throw new IllegalStateException("Field " + fieldName + " with value " + field + " is  a of the expected type: " + expected.getName());
    }
 
-   /*
+   /**
+    * Only write out the fields that should be usable by a remote client.
+    * Excludes:
+    * PROPERTY_INFO
+    * 
+    * @param out
+    * @throws IOException
+    */
    private void writeObject(java.io.ObjectOutputStream out)
       throws IOException
    {
       for (Map.Entry<String, Serializable> entry : fields.entrySet())
       {
-         
+         if(entry.getKey().equals(PROPERTY_INFO))
+            continue;
+         out.writeUTF(entry.getKey());
+         out.writeObject(entry.getValue());
       }
+      out.writeUTF(END_MARKER);
    }
    private void readObject(java.io.ObjectInputStream in)
       throws IOException, ClassNotFoundException
    {
-   
+      fields = new HashMap<String, Serializable>();
+      String key;
+      do
+      {
+         key = in.readUTF();
+         if(key.equals(END_MARKER))
+            key = null;
+         else
+         {
+            Serializable value = (Serializable) in.readObject();
+            fields.put(key, value);
+         }
+      } while(key != null);
    }
-   */
 }




More information about the jboss-cvs-commits mailing list