INSERT DATA without closing } causes an endless (until OutOfMemory) loop

Description

Minimal code to reproduce:

Sesame fails to parse an INSERT DATA update with a missing closing }. Parsing such an update leads to an endless loop in the ast parser classes. When the string ends an IOException is thrown (Stream closed) but when that exception is caught in SyntaxTreeBuilderTokenManager.getNextToken() it just returns an empty token (""). Then SyntaxTreeBuilder.ASTUpdateSequence.readToMatchingBrace() just keeps calling getNextToken() and every time it loops it adds a space to a StringBuilder instance. This loops until all the memory is eaten up by StringBuilder and an OutOfMemoryError is thrown.

Environment

None

Assignee

Jeen Broekstra

Reporter

Pavel Mihaylov

Labels

None

Components

Fix versions

Affects versions

Priority

Blocker
Configure