Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.0.2
-
None
-
None
-
Windows XP
-
New
Description
I've been trying to run the example PrecisionRecall.java code from Lucene in Action II (downloaded the code, so its just as in the book). It gives a StringIndexOutOfBoundsException on my machine.
Figured it out. I copied QualityBenchmark and QualityStats from the Lucene source and inserted a debugline to get a view of the argument values in the function that throws the exception.
private String fracFormat(String frac) {
int k = frac.indexOf('.');
String s1 = padd+frac.substring(0,k);
int n = Math.max(k,6);
s1 = s1.substring(s1.length()-n);
return s1 + frac.substring(k);
}
This function assumes that a decimal '.' is being used. However, the PC's we use over here at uni have a different locale using a ',' for decimals. Think you might be able to catch that by using (new DecimalFormatSymbols().getDecimalSeparator()) instead of ('.')?