Skip to content

Commit

Permalink
Fix for the oob condition when processing author names
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Feb 25, 2020
1 parent f7cfa3b commit bc2ce6b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public void collect(int i) {
String[] vals = d.getValues(f);

for (String s: vals) {
//System.out.println(s);
//System.out.println(AuthorUtils.normalizeAuthor(s));
System.out.println(s);
System.out.println(AuthorUtils.normalizeAuthor(s));
s = s.toLowerCase();

TokenStream ts = analyzer.tokenStream(targetAnalyzer, new StringReader(s));
Expand Down Expand Up @@ -290,7 +290,7 @@ private boolean shortened(String[]nameParts, String[][] otherNames) {
if (nameParts[i].length() > 1) {
nameParts[i] = nameParts[i].substring(0, 1);
for (String[] other: otherNames) {
if (other[i] == null || other[i].length() < 2)
if (other.length <= i || other[i] == null || other[i].length() < 2)
return false; // this may happen if synonyms map the name to a shorter version, my solution is to stop processing (cheap?)
other[i] = other[i].substring(0, 1);
}
Expand Down

0 comments on commit bc2ce6b

Please sign in to comment.