damnhandy / Handy-URI-Templates

A Java URI Template processor implementing RFC6570
https://damnhandy.github.io/Handy-URI-Templates/
Other
202 stars 37 forks source link

Cannot expand an exploded template variable #33

Closed janbols closed 8 years ago

janbols commented 8 years ago

Using 2.0.4

When creating an exploded VarSpec name "experiment", the object is initialized with a variableName = "experimen" because the last character is substringed away on line 157.

As a result that variable is not expanded in UriTemplate#expandVariables line 592.

As a temporary workaround I can initialize the exploded VarSpec by adding the * to its value like here:

new VarSpec("experiment*", Modifier.EXPLODE, null) 
damnhandy commented 8 years ago

Sorry, slightly confused. Does this issue occur when expanding a template or when you're calling VarSpec directly? If it is a template issue, do can you provide the template expression you are using and the values you're passing to it?

damnhandy commented 8 years ago

I have added a test case to help isolate the issue here:

https://github.com/damnhandy/Handy-URI-Templates/blob/master/src/test/java/com/damnhandy/uri/template/impl/TestVarSpec.java

So far, I am not able to get the the behavior you are seeing. If you provide a test case that demonstrates the problem, I'll fix it. I'll leave this open for now but will address it in a future release, after 2.1.0. Please write your test against 2.1.0.

janbols commented 8 years ago

Hi, I added 3 tests (2 failing, 1 succeeding) that show the bug and created a pull request for it.

Best regards Jan

damnhandy commented 8 years ago

This is now in the 2.1.2 snapshot

janbols commented 8 years ago

Thank you for the work and for a nice useful library ;-)