[rules-dev] Small patch against WorkingMemoryInMemoryLogger

jschmied nabble at juergenschmied.de
Thu Jan 27 09:57:03 EST 2011


Hi!

The WorkingMemoryInMemoryLogger writes a different format compared to the
WorkingMemoryFileLogger. This patch fixes this.
--------
--- Desktop/WorkingMemoryInMemoryLogger.java	Thu Jan 27 15:49:55 2011
+++ WorkingMemoryInMemoryLogger.java	Fri Oct 15 11:16:19 2010
@@ -52,15 +52,19 @@
     	super( session );
     }
 
+	@Override
     @SuppressWarnings("unchecked")
 	public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
         super.readExternal(in);
         events  = (List<LogEvent>) in.readObject();
     }
 
+	@Override
     public void writeExternal(ObjectOutput out) throws IOException {
         super.writeExternal(out);
-        out.writeObject(events);
+		for (LogEvent event : events) {
+			out.writeObject(event);
+		}
     }
 
     public String getEvents() {
@@ -68,7 +72,9 @@
         StringWriter writer = new StringWriter();
         try {
             final ObjectOutputStream out =
xstream.createObjectOutputStream(writer);
-        	out.writeObject( this.events );
+			for (LogEvent event : events) {
+				out.writeObject(event);
+			}
             out.close();
         } catch (Throwable t) {
         	throw new RuntimeException("Unable to create event output: " +
t.getMessage());
--------

could somebody apply this?

Thanks!
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Small-patch-against-WorkingMemoryInMemoryLogger-tp2362911p2362911.html
Sent from the Drools - Dev mailing list archive at Nabble.com.


More information about the rules-dev mailing list