xdrop/fuzzywuzzy

StringIndexOutOfBoundsException in partialratio

kartheekgurram opened this issue · 2 comments

java.lang.StringIndexOutOfBoundsException: String index out of range: 49
at java.lang.String.substring(String.java:1963)
at com.xdrop.fuzzywuzzy.ratios.PartialRatio.apply(PartialRatio.java:43)
at com.xdrop.fuzzywuzzy.FuzzySearch.partialRatio(FuzzySearch.java:45)

test case:
FuzzySearch.partialRatio("pros holdings, inc.","settlement facility dow corning trust")

I could fix it by doing this :
String long_substr = longer.substring(long_start,long_end>longer.length()?longer.length():long_end);

xdrop commented

Thanks for reporting this!

Should be fixed by #10