[jboss-svn-commits] JBL Code SVN: r18451 - labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Feb 10 21:22:32 EST 2008


Author: KrisVerlaenen
Date: 2008-02-10 21:22:32 -0500 (Sun, 10 Feb 2008)
New Revision: 18451

Modified:
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java
Log:
JSR-1462: Improve audit to support realtime auditing

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java	2008-02-10 12:15:17 UTC (rev 18450)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java	2008-02-11 02:22:32 UTC (rev 18451)
@@ -1,5 +1,6 @@
 package org.drools.eclipse.debug;
 
+import java.io.EOFException;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
@@ -47,6 +48,7 @@
 import org.eclipse.ui.PartInitException;
 
 import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.StreamException;
 
 public class AuditView extends AbstractDebugView {
 	
@@ -82,21 +84,29 @@
     		getViewer().setInput(null);
     		return;
     	}
+        List<LogEvent> eventList = new ArrayList<LogEvent>();
 		try {
 			XStream xstream = new XStream();
 			ObjectInputStream in = xstream.createObjectInputStream(
 				new FileReader(logFileName));
-			getViewer().setInput(createEventList((List) in.readObject()));
-			// TODO: this is necessary because otherwise, the show cause action
-			// cannot find the cause event if it hasn't been shown yet
-			((TreeViewer) getViewer()).expandAll();
+			try {
+                while (true) {
+                    eventList.add((LogEvent) in.readObject());
+                }
+            } catch (StreamException e) {
+                if (!(e.getCause() instanceof EOFException)) {
+                    throw e;
+                }
+            }
 		} catch (FileNotFoundException e) {
 			setLogFile(null);
-			getViewer().setInput(null);
 		} catch (Throwable t) {
 			DroolsEclipsePlugin.log(t);
-			getViewer().setInput(null);
 		}
+        getViewer().setInput(createEventList(eventList));
+        // TODO: this is necessary because otherwise, the show cause action
+        // cannot find the cause event if it hasn't been shown yet
+        ((TreeViewer) getViewer()).expandAll();
     }
     
     protected List createEventList(List logEvents) {




More information about the jboss-svn-commits mailing list