On 03/07/2011 08:07 PM, Norman Maurer wrote:
To be honest, I don't think the use of one class satisfy the dependency of
commons-collection. As the implementation is such a trivial one.

Your right, thanks for heads up. I thought it to be used in other mailbox modules as it's defined in the dependencyManagement section...
That's also a way to clean up dependencyManagement ;)

Would this be ok

public Iterator<MessageResult> getIterator() {
  if (iterator == null) {
    return new ResultIterator<Id>(null, null);
  }
  return iterator;
}

or is it better to add the EmptyIterator from common-collections as static inner class?

Thanks
Felix


Bye,
Norman

2011/3/7 Felix Knecht<[email protected]>

@Wojtek

Hi

Can you please review fix if it is also in your sense? Otherwise please
correct fix. Without EmptyIterator it breaks tests done by
mailbox-integration-tests project.

Thanks
Felix



On 03/07/2011 07:08 PM, [email protected] wrote:

Author: felixk
Date: Mon Mar  7 18:08:11 2011
New Revision: 1078874

URL: http://svn.apache.org/viewvc?rev=1078874&view=rev
Log:
This seems to cause the mailbox-integration-test failures.
"public Iterator<MessageResult>   getMessages(...)" may now return a null
value, which wasn't the case before commit 1078490 [1]. It should IMO at
least an
EmptyIterator instead of a null value.

[1] http://svn.apache.org/viewvc?rev=1078490&view=rev

Modified:
     james/mailbox/trunk/store/pom.xml

james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java

Modified: james/mailbox/trunk/store/pom.xml
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/store/pom.xml?rev=1078874&r1=1078873&r2=1078874&view=diff

==============================================================================
--- james/mailbox/trunk/store/pom.xml (original)
+++ james/mailbox/trunk/store/pom.xml Mon Mar  7 18:08:11 2011
@@ -53,6 +53,10 @@
        <artifactId>lucene-analyzers</artifactId>
      </dependency>
      <dependency>
+<groupId>commons-collections</groupId>
+<artifactId>commons-collections</artifactId>
+</dependency>
+<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>

Modified:
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java?rev=1078874&r1=1078873&r2=1078874&view=diff

==============================================================================
---
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
(original)
+++
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
Mon Mar  7 18:08:11 2011
@@ -38,6 +38,7 @@ import javax.mail.Flags;
  import javax.mail.Flags.Flag;
  import javax.mail.util.SharedFileInputStream;

+import org.apache.commons.collections.iterators.EmptyIterator;
  import org.apache.james.mailbox.MailboxException;
  import org.apache.james.mailbox.MailboxListener;
  import org.apache.james.mailbox.MailboxSession;
@@ -485,7 +486,11 @@ public abstract class StoreMessageManage
                  iterator = it;
              }

+            @SuppressWarnings("unchecked")
              public Iterator<MessageResult>   getIterator() {
+               if (iterator == null) {
+                   return
(Iterator<MessageResult>)EmptyIterator.INSTANCE;
+               }
                  return iterator;
              }
          }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to