ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1632294 - in /ace/trunk/org.apache.ace.log: src/org/apache/ace/log/server/store/impl/LogStoreImpl.java test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
Date Thu, 16 Oct 2014 13:13:31 GMT
Author: marrs
Date: Thu Oct 16 13:13:30 2014
New Revision: 1632294

URL: http://svn.apache.org/r1632294
Log:
ACE-487 Fixed the bug and updated the test case.

Modified:
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java
    ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java

Modified: ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java?rev=1632294&r1=1632293&r2=1632294&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java
(original)
+++ ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/store/impl/LogStoreImpl.java
Thu Oct 16 13:13:30 2014
@@ -260,10 +260,8 @@ public class LogStoreImpl implements Log
                 // and sort
                 Collections.sort(list);
                 // and remove if necessary
-                for (int i = 0; i < m_maxEvents; i++) {
-                    if (list.size() > 0) {
-                        list.remove(0);
-                    }
+                while (list.size() > m_maxEvents) {
+                	list.remove(0);
                 }
                 out = new PrintWriter(new FileWriter(new File(dir, logID.toString())));
             }
@@ -422,12 +420,8 @@ public class LogStoreImpl implements Log
         obtainLock(targetID, logID);
         try {
             List<Event> events = getInternal(new Descriptor(targetID, logID, SortedRangeSet.FULL_SET));
-            if (events.size() > m_maxEvents) {
-                for (int i = 0; i < m_maxEvents; i++) {
-                    if (events.size() > 0) {
-                        events.remove(0);
-                    }
-                }
+            while (events.size() > m_maxEvents) {
+            	events.remove(0);
             }
             put(targetID, logID, events);
         }

Modified: ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java?rev=1632294&r1=1632293&r2=1632294&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
(original)
+++ ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/store/impl/ServerLogStoreTester.java
Thu Oct 16 13:13:30 2014
@@ -173,8 +173,8 @@ public class ServerLogStoreTester {
     public void testClean() throws Exception {
         List<Event> events = new ArrayList<Event>();
         for (String target : new String[] { "target"}) {
-            for (long log : new long[] { 1,2 }) {
-                for (long id : new long[] { 1, 2 }) {
+            for (long log : new long[] { 1, 2 }) {
+                for (long id : new long[] { 1, 2, 3, 4 }) {
                     events.add(new Event(target, log, id, System.currentTimeMillis(), AuditEvent.FRAMEWORK_STARTED,
new HashMap<String, String>()));
                 }
             }



Mime
View raw message