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.