From 4f1bbb5e8755ced9c5d8140d401a7886eeff8738 Mon Sep 17 00:00:00 2001 From: Koji Sekiguchi Date: Sun, 11 Oct 2009 10:04:01 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 3 +++ .../org/apache/solr/handler/AnalysisRequestHandlerBase.java | 3 ++- src/webapp/web/admin/analysis.jsp | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5d8f44439c8..313529351c9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -622,6 +622,9 @@ Bug Fixes 71. SOLR-1448: Add weblogic.xml to solr webapp to enable correct operation in WebLogic. (Ilan Rabinovitch via yonik) +72. SOLR-1504: empty char mapping can cause ArrayIndexOutOfBoundsException in analysis.jsp and co. + (koji) + Other Changes ---------------------- 1. Upgraded to Lucene 2.4.0 (yonik) diff --git a/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java b/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java index ed749b27db4..d9e528defe5 100644 --- a/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java +++ b/src/java/org/apache/solr/handler/AnalysisRequestHandlerBase.java @@ -216,7 +216,8 @@ public abstract class AnalysisRequestHandlerBase extends RequestHandlerBase { } catch (IOException 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 ); out.add( input.getClass().getName(), sb.toString()); return sb.toString(); diff --git a/src/webapp/web/admin/analysis.jsp b/src/webapp/web/admin/analysis.jsp index a19658047a7..c32c897911c 100644 --- a/src/webapp/web/admin/analysis.jsp +++ b/src/webapp/web/admin/analysis.jsp @@ -483,7 +483,8 @@ StringBuilder sb = new StringBuilder(); do { len = input.read( buf, 0, BUFFER_SIZE ); - sb.append(buf, 0, len); + if( len > 0 ) + sb.append(buf, 0, len); } while( len == BUFFER_SIZE ); out.print(""); XML.escapeCharData(sb.toString(),out);