On Apr 26, 2010, at 5:47 PM, Evan Schoenberg, M.D. wrote:

> So LMX is supposed to be able to take data in chunks, from the end of the 
> file.  It turns out that this doesn't work if a chunk breaks up an entity, 
> though.
> 
> A chat transcript, submitted by lhirlimann to me via email by request, 
> exhibits this behavior on my machine, when read by 
> -[DCMessageContextDisplayPlugin contextForChat:], since that method reads in 
> 4*getpagesize() byte chunks and that number of bytes from the end is the 
> middle of an entity.
> 
> Specifically, the resulting chunk #1 starts with 'apos'.  The resulting chunk 
> #2 ends with '&'.
> 
> The result is an assertion failure:
>  *** Assertion failure in -[LMXParser parseEntityReference:], 
> /Volumes/Huffman/Projects/lmx-sholt/LMXParser.m:605
> "entity name was empty! currentIndex is 5193 (&) out of 21579 bytes"
> 
> It's not clear to me how to proceed with a fix.  Do you (yes, you!) have any 
> ideas?
> 
> I don't want to post the user's chat log to a public mailing list; if you're 
> an existing developer and would like it in order to easily see the behavior, 
> email me off-list.
> 
> This took way too long to hunt down, though it's a fairly obvious problem in 
> retrospect.
> 
> Cheers,
> Evan

Silly hackish fix: @try { thing that throws assertion failure } @catch (...) { 
read a few more bytes so we're not in mid-entity and try again }

        David


Reply via email to