jakartaee / jakartaee/mail-api
ArrayIndexOutOfBoundsException com.sun.mail.imap.MessageCache.getMessage
- Dominant language
- Java
- Stars
- 285
- Forks
- 109
- Avg merge
- 15h 19m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
```
java.lang.ArrayIndexOutOfBoundsException: message number (0) out of bounds (0)
at com.sun.mail.imap.MessageCache.getMessage(SourceFile:116)
at com.sun.mail.imap.MessageCache.getMessageBySeqnum(SourceFile:148)
at com.sun.mail.imap.IMAPFolder.getMessageBySeqNumber(SourceFile:3999)
at com.sun.mail.imap.IMAPFolder.processFetchResponse(SourceFile:3604)
at com.sun.mail.imap.IMAPFolder.handleResponse(SourceFile:3586)
at com.sun.mail.iap.Protocol.notifyResponseHandlers(SourceFile:245)
at com.sun.mail.imap.protocol.IMAPProtocol.fetchSequenceNumber(SourceFile:2004)
at com.sun.mail.imap.IMAPFolder.getMessageByUID(SourceFile:2598)
```
Where:
```message number (0) out of bounds (0..n)```
**To Reproduce**
This happens occasionally. Unfortunately, I cannot provide a protocol log because these exceptions are being gathered by Bugsnag.
**Expected behavior**
No exception
**Smartphone (please complete the following information):**
- Device: multiple
- OS: Android
- Version multiple
**Mail server:**
- Protocol being used: IMAP
- Vendor/product: unknown
- Mail service URL: unknown
**Additional context**
Refs #404
Contributor guide
Research direction
Start at com.sun.mail.imap.MessageCache.getMessage in the stack trace and trace the callers through getMessageBySeqnum, IMAPFolder.processFetchResponse, and getMessageByUID. Reproduction details are incomplete because the failure is occasional and no protocol log or server information is provided; done means identifying and preventing the out-of-bounds exception, with regression coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100