I'm not sure, the Matcher.quoteReplacement() has to happen at the point
where the Regex.replaceAll() is called AFAIK

You maybe able to drop in the compiled .class file for the latest
ParameterizedSparqlString from a current build since it shouldn't rely on
anything that wasn't present in 2.9.2


Given that there have been 4 further ARQ releases since 2.9.2 you may want
to bug the TQ guys about putting out an updated SPIN release.

Rob

On 6/24/13 10:04 AM, "Martynas Jusevičius" <[email protected]> wrote:

>Sorry, forgot to mention -- I'm using ARQ 2.9.2. And stuck with it
>because SPIN 1.3.0 depends on it...
>
>Can I still use some version of the fix?
>
>On Mon, Jun 24, 2013 at 8:00 PM, Rob Vesse <[email protected]> wrote:
>> 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" <[email protected]> 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(ParameterizedSp
>>>ar
>>>qlString.java:616)
>>>
>>>com.hp.hpl.jena.query.ParameterizedSparqlString.asQuery(ParameterizedSpa
>>>rq
>>>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