SOLR-1504: empty char mapping can cause ArrayIndexOutOfBoundsException in analysis.jsp and co.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@824045 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2009-10-11 10:04:01 +00:00
parent 83fa285c40
commit 4f1bbb5e87
3 changed files with 7 additions and 2 deletions

View File

@ -622,6 +622,9 @@ Bug Fixes
71. SOLR-1448: Add weblogic.xml to solr webapp to enable correct operation in 71. SOLR-1448: Add weblogic.xml to solr webapp to enable correct operation in
WebLogic. (Ilan Rabinovitch via yonik) WebLogic. (Ilan Rabinovitch via yonik)
72. SOLR-1504: empty char mapping can cause ArrayIndexOutOfBoundsException in analysis.jsp and co.
(koji)
Other Changes Other Changes
---------------------- ----------------------
1. Upgraded to Lucene 2.4.0 (yonik) 1. Upgraded to Lucene 2.4.0 (yonik)

View File

@ -216,7 +216,8 @@ public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase {
} catch (IOException e) { } catch (IOException e) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
} }
sb.append(buf, 0, len); if( len > 0 )
sb.append(buf, 0, len);
} while( len == BUFFER_SIZE ); } while( len == BUFFER_SIZE );
out.add( input.getClass().getName(), sb.toString()); out.add( input.getClass().getName(), sb.toString());
return sb.toString(); return sb.toString();

View File

@ -483,7 +483,8 @@
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
do { do {
len = input.read( buf, 0, BUFFER_SIZE ); len = input.read( buf, 0, BUFFER_SIZE );
sb.append(buf, 0, len); if( len > 0 )
sb.append(buf, 0, len);
} while( len == BUFFER_SIZE ); } while( len == BUFFER_SIZE );
out.print("<td class=\"debugdata\">"); out.print("<td class=\"debugdata\">");
XML.escapeCharData(sb.toString(),out); XML.escapeCharData(sb.toString(),out);