Java with Spark Framework: trouble with params


Hello the team,
I have been playing with the combination of java - spark - react and am having a lot of trouble with getting my routes to behave as expected.

If my route is …/item/100 then everything works as I expect

If my route is …/item/B then for some reason, even though the parameter is correctly set to be type String, value “B”, in the spark server (I can see it when I log it out) my java backend doesn’t recognise it when I pass it into a function that searches for an item by string identifier.

I’m going quietly crazy here.

Any suggestions as to what daft mistake I’m making?


Solved. My method was using == to compare strings, which worked for all the tests, but didn’t work when running on the server. Sigh. Newbie bear trap, so I’ll leave this here in case it helps someone else.