From 15a9d6b543027a83d43978ea7b0bac5c78f17c7f Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Mon, 9 Mar 2009 14:55:40 +0000 Subject: [PATCH] SOLR-1053 -- IndexOutOfBoundsException in SolrWriter.getResourceAsString when size of data-config.xml is a multiple of 1024 bytes git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@751696 13f79535-47bb-0310-9956-ffa450edef68 --- contrib/dataimporthandler/CHANGES.txt | 4 ++++ .../java/org/apache/solr/handler/dataimport/SolrWriter.java | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/dataimporthandler/CHANGES.txt b/contrib/dataimporthandler/CHANGES.txt index 2e695b1d5e4..5ab50dfba1a 100644 --- a/contrib/dataimporthandler/CHANGES.txt +++ b/contrib/dataimporthandler/CHANGES.txt @@ -161,6 +161,10 @@ Bug Fixes 21.SOLR-1042: Fix memory leak in DIH by making TemplateString non-static member in VariableResolverImpl (Ryuuichi Kumai via shalin) +22.SOLR-1053: IndexOutOfBoundsException in SolrWriter.getResourceAsString when size of data-config.xml is a + multiple of 1024 bytes. + (Herb Jiang via shalin) + Documentation ---------------------- diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java index dc92ece4028..d3fc0054c9e 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/SolrWriter.java @@ -192,11 +192,8 @@ public class SolrWriter { byte[] buf = new byte[1024]; int sz = 0; try { - while (true) { - sz = in.read(buf); + while ((sz = in.read(buf)) != -1) { baos.write(buf, 0, sz); - if (sz < buf.length) - break; } } finally { try {