I added some additional test cases based on what you described but I
cannot reproduce, please can you provide a sample input that reproduces
the issue to aid debugging.

The current code already uses Matcher.quoteReplacement() internally, doing
it pre-emptively prior to passing in the input won't make any difference.

What version of ARQ is this?

The only way I can think you might hit this issue if you use a really
early version ARQ when ParameterizedSparqlString was new and before it had
been fixed to use Matcher.quoteReplacement(), that was added by Stephen
along with some tests for use of various regex special characters in svn
revision 1367820 which was almost 11 months ago now.

Rob


On 6/24/13 8:55 AM, "Martynas Jusevičius" <marty...@graphity.org> wrote:

>Hey,
>
>I'm using the following code to build a SPARQL query that will check
>user credentials:
>
>  QuerySolutionMap qsm = new QuerySolutionMap();
>  qsm.add("name", ResourceFactory.createTypedLiteral(username));
>  qsm.add("password", ResourceFactory.createTypedLiteral(passwordHash));
>  ParameterizedSparqlString queryString = new
>ParameterizedSparqlString(sparqlString, qsm);
>  Query query = queryString.asQuery();
>
>The passwordHash might contain $ characters, in which case I get the
>following exception:
>
>  java.lang.IllegalArgumentException: Illegal group reference
>  java.util.regex.Matcher.appendReplacement(Matcher.java:808)
>  java.util.regex.Matcher.replaceAll(Matcher.java:906)
>  
>com.hp.hpl.jena.query.ParameterizedSparqlString.toString(ParameterizedSpar
>qlString.java:616)
>  
>com.hp.hpl.jena.query.ParameterizedSparqlString.asQuery(ParameterizedSparq
>lString.java:654)
>
>I read about the issue and tried to escape the replacement string:
>
>  passwordHash = Matcher.quoteReplacement(passwordHash)
>
>However, this did not solve the problem. I take it's a regexp issue.
>Any ideas on how to work around it?
>
>Martynas
>graphityhq.com

Reply via email to