Author: norman
Date: Fri Aug 19 11:28:23 2011
New Revision: 1159597
URL: http://svn.apache.org/viewvc?rev=1159597&view=rev
Log:
just formatting
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
Modified:
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
URL:
http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java?rev=1159597&r1=1159596&r2=1159597&view=diff
==============================================================================
---
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
(original)
+++
james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/SearchProcessor.java
Fri Aug 19 11:28:23 2011
@@ -390,62 +390,68 @@ public class SearchProcessor extends Abs
final List<SearchQuery.NumericRange> ranges = new
ArrayList<SearchQuery.NumericRange>();
final SelectedMailbox selected = session.getSelected();
boolean useUids = !msn;
-
+
// First of check if we have any messages in the mailbox
// if not we don't need to go through all of this
if (selected.existsCount() > 0) {
- for (int i = 0; i < length; i++) {
+ for (int i = 0; i < length; i++) {
final IdRange range = sequenceNumbers[i];
-
+
long lowVal = range.getLowVal();
long highVal = range.getHighVal();
if (useUids) {
- // Take care of "*" and "*:*" values by return the last
message in
- // the mailbox. See IMAP-289
- if (lowVal == Long.MAX_VALUE && highVal ==
Long.MAX_VALUE) {
- ranges.add(new
SearchQuery.NumericRange(selected.getLastUid()));
- } else if (highVal == Long.MAX_VALUE &&
selected.getLastUid() < lowVal) {
- // Sequence uid ranges which use
*:<uid-higher-then-last-uid>
- // MUST return at least the highest uid in the
mailbox
- // See IMAP-291
+ // Take care of "*" and "*:*" values by return the last
+ // message in
+ // the mailbox. See IMAP-289
+ if (lowVal == Long.MAX_VALUE && highVal == Long.MAX_VALUE)
{
ranges.add(new
SearchQuery.NumericRange(selected.getLastUid()));
- } else {
+ } else if (highVal == Long.MAX_VALUE &&
selected.getLastUid() < lowVal) {
+ // Sequence uid ranges which use
+ // *:<uid-higher-then-last-uid>
+ // MUST return at least the highest uid in the mailbox
+ // See IMAP-291
+ ranges.add(new
SearchQuery.NumericRange(selected.getLastUid()));
+ } else {
ranges.add(new SearchQuery.NumericRange(lowVal,
highVal));
- }
+ }
} else {
- // Take care of "*" and "*:*" values by return the last
message in
+ // Take care of "*" and "*:*" values by return the last
+ // message in
// the mailbox. See IMAP-289
if (lowVal == Long.MAX_VALUE && highVal == Long.MAX_VALUE)
{
highVal = selected.getLastUid();
-
- ranges.add(new SearchQuery.NumericRange(highVal));
- } else {
- if (lowVal != Long.MIN_VALUE) {
- lowVal =
selected.uid((int) lowVal);
- } else {
- lowVal =
selected.getFirstUid();
- }
-
- // The lowVal should never be
SelectedMailbox.NO_SUCH_MESSAGE but we check for it just to be safe
- if (lowVal !=
SelectedMailbox.NO_SUCH_MESSAGE) {
- if (highVal !=
Long.MAX_VALUE) {
- highVal =
selected.uid((int) highVal);
- if (highVal ==
SelectedMailbox.NO_SUCH_MESSAGE) {
- // we
requested a message with a MSN higher then
- // the
current msg count. So just use the
- //
highest uid as max
- highVal
= selected.getLastUid();
- }
- } else {
- highVal =
selected.getLastUid();
- }
- ranges.add(new
SearchQuery.NumericRange(lowVal, highVal));
- }
- }
+
+ ranges.add(new SearchQuery.NumericRange(highVal));
+ } else {
+ if (lowVal != Long.MIN_VALUE) {
+ lowVal = selected.uid((int) lowVal);
+ } else {
+ lowVal = selected.getFirstUid();
+ }
+
+ // The lowVal should never be
+ // SelectedMailbox.NO_SUCH_MESSAGE but we check for it
+ // just to be safe
+ if (lowVal != SelectedMailbox.NO_SUCH_MESSAGE) {
+ if (highVal != Long.MAX_VALUE) {
+ highVal = selected.uid((int) highVal);
+ if (highVal ==
SelectedMailbox.NO_SUCH_MESSAGE) {
+ // we requested a message with a MSN higher
+ // then
+ // the current msg count. So just use the
+ // highest uid as max
+ highVal = selected.getLastUid();
+ }
+ } else {
+ highVal = selected.getLastUid();
+ }
+ ranges.add(new SearchQuery.NumericRange(lowVal,
highVal));
+ }
+ }
}
}
}
-
+
Criterion crit = SearchQuery.uid(ranges.toArray(new
SearchQuery.NumericRange[0]));
return crit;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]