You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Shalin Shekhar Mangar (JIRA)" <ji...@apache.org> on 2009/03/09 15:56:52 UTC
[jira] Updated: (SOLR-1053) SolrWriter.getResourceAsString
IndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/SOLR-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shalin Shekhar Mangar updated SOLR-1053:
----------------------------------------
Fix Version/s: 1.4
Affects Version/s: (was: 1.4)
1.3
Summary: SolrWriter.getResourceAsString IndexOutOfBoundsException (was: SolrWriter.getResourceAsString IndexOutOfBounceException)
> SolrWriter.getResourceAsString IndexOutOfBoundsException
> --------------------------------------------------------
>
> Key: SOLR-1053
> URL: https://issues.apache.org/jira/browse/SOLR-1053
> Project: Solr
> Issue Type: Bug
> Components: contrib - DataImportHandler
> Affects Versions: 1.3
> Environment: All
> Reporter: Herb Jiang
> Assignee: Shalin Shekhar Mangar
> Fix For: 1.4
>
> Attachments: SOLR-1053.patch
>
>
> It will got excexception when the size of data-config.xml are times of 1024bytes.
> Maybe it should check the sz==-1 when in.read(buf) reach the EOF.
> {noformat}
> #### ORIGINAL CODE ####
> static String getResourceAsString(InputStream in) throws IOException {
> ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
> byte[] buf = new byte[1024];
> int sz = 0;
> try {
> while (true) {
> sz = in.read(buf);
>
> baos.write(buf, 0, sz);
> if (sz < buf.length)
> break;
> }
> } finally {
> try {
> in.close();
> } catch (Exception e) {
> }
> }
> return new String(baos.toByteArray());
> }
> {noformat}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.