[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] IndexOutOfBoundsException in RawParseUtils.decodeNoFallback

On Mon, Mar 22, 2010 at 8:00 AM, Marc Strapetz
<marc.strapetz@xxxxxxxxxxx> wrote:
> One of our users has reported following exception against an older
> version of jgit (so I have skipped line numbers):
>
> java.lang.IndexOutOfBoundsException
>  at java.nio.ByteBuffer.wrap
>  at org.eclipse.jgit.util.RawParseUtils.decodeNoFallback
>  at org.eclipse.jgit.util.RawParseUtils.decode
>  at org.eclipse.jgit.util.RawParseUtils.parsePersonIdent
>  at org.eclipse.jgit.revwalk.RevCommit.getAuthorIdent
>
> AFAIU this is caused by a strange (or even invalid?) author-line in the
> commit. RawParseUtils.parsePersonIdent is not fault-tolerant here. Now
> I'm wondering how to fix that best:
>
> Check emailB and emailE and, if these indices are bad, return a PersonIdent?
>
> Or even return null if something is wrong?

Return null if the identity cannot be parsed.  A malformed identity is
essentially not present.  Though I'd be interested in knowing what the
malformed identity looks like, maybe our parsing is being a bit too
strict.