History | Log In     View a printable version of the current page. Get help!  
Issue Details [XML]

Key: SES-640
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Minor Minor
Assignee: Arjohn Kampman
Reporter: Simon Schenk
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Sesame

SPARQL Parser unescapes backslashes twice

Created: 18/Nov/08 05:27 PM   Updated: 17/Dec/08 02:06 PM
Component/s: SPARQL
Affects Version/s: 3.x
Fix Version/s: None


 Description   
The SPARQL Parser double-unescapes backslashes. Example:

public void testBackslashParsing() throws MalformedQueryException {
String query = "SELECT * WHERE {?s ?p \"\\\\\"}";
SPARQLParser parser = new SPARQLParser();
ParsedQuery pq = parser.parseQuery(query, null);
Projection proj = (Projection)pq.getTupleExpr();
StatementPattern sp = (StatementPattern)proj.getArg();
// succeeds:
assertEquals(sp.getObjectVar().getValue().stringValue(), "\\");
// fails:
assertEquals(sp.getObjectVar().getValue().stringValue(), "\\\\");
}

 All   Comments   Change History      Sort Order:
Comment by Herko ter Horst [18/Nov/08 05:41 PM]
Unless I'm very much mistaken, \ is a SPARQL escape character as well as a Java escape character, so your query actually contains only a single backslash.

Comment by Simon Schenk [19/Nov/08 07:41 AM]
Right, it is.

Comment by Arjohn Kampman [19/Nov/08 10:03 AM]
Issue is invalid: the double un-escape is correct, since it's a combination of Java-escapes and SPARQL-escapes.