lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grant Ingersoll (JIRA)" <>
Subject [jira] Created: (LUCENE-980) Formatting error in ReportTask in contrib/benchmark
Date Thu, 16 Aug 2007 01:59:32 GMT
Formatting error in ReportTask in contrib/benchmark

                 Key: LUCENE-980
             Project: Lucene - Java
          Issue Type: Bug
          Components: contrib/benchmark
    Affects Versions: 2.2
            Reporter: Grant Ingersoll
            Priority: Minor
             Fix For: 2.3

I am building a new Task, AnalyzerTask, that lets you change the Analyzer in the loop, thus
allowing for the comparison of the same Analyzers over the set of documents.

My algorithm declaration looks like:
NewAnalyzer(WhitespaceAnalyzer, SimpleAnalyzer, StopAnalyzer, standard.StandardAnalyzer)

And it could be longer.

The exception is:
Error: cannot execute the algorithm! String index out of range: 85
java.lang.StringIndexOutOfBoundsException: String index out of range: 85
	at java.lang.String.substring(
	at org.apache.lucene.benchmark.byTask.utils.Format.format(
	at org.apache.lucene.benchmark.byTask.tasks.ReportTask.tableTitle(
	at org.apache.lucene.benchmark.byTask.tasks.ReportTask.genPartialReport(
	at org.apache.lucene.benchmark.byTask.tasks.RepSumByNameTask.reportSumByName(
	at org.apache.lucene.benchmark.byTask.tasks.RepSumByNameTask.doLogic(
	at org.apache.lucene.benchmark.byTask.tasks.PerfTask.runAndMaybeStats(
	at org.apache.lucene.benchmark.byTask.tasks.TaskSequence.doSerialTasks(
	at org.apache.lucene.benchmark.byTask.tasks.TaskSequence.doLogic(
	at org.apache.lucene.benchmark.byTask.utils.Algorithm.execute(
	at org.apache.lucene.benchmark.byTask.Benchmark.execute(
	at org.apache.lucene.benchmark.byTask.Benchmark.main(

The error seems to be caused by the fact that ReportTask uses the OP (operation) column for
the String, but then uses the length of the algorithm declaration to index into the String,
resulting in the index out of bounds exception.

The line in question is:
return (s + padd).substring(0, col.length());

And probably should be changed to something like:
    String s1 = (s + padd);
    return s1.substring(0, Math.min(col.length(), s1.length()));

Either that or the column should be trimmed.  The workaround is to explicitly name the task.

If no objections, I will make the change, tomorrow.  

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message