You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Iliev Andrei (JIRA)" <ji...@apache.org> on 2008/08/25 16:47:44 UTC
[jira] Created: (LUCENENET-145) Bug in documentswriter.cs
Bug in documentswriter.cs
-------------------------
Key: LUCENENET-145
URL: https://issues.apache.org/jira/browse/LUCENENET-145
Project: Lucene.Net
Issue Type: Bug
Reporter: Iliev Andrei
Priority: Critical
Bad conversion from java source code. For multiple dimention array .length in java returns the number of dimensions. In c# .Length - returns the total number of elements in all dimensions. This bug sometimes lead to IndexOutOfRangeException as reported in http://www.mail-archive.com/lucene-net-dev@incubator.apache.org/msg01277.html
See the follwing code:
1)class ByteBlockPool.
1) Method Reset()
wrong:
//Array.Clear(buffers[i], 0, buffers.Length);
should be:
Array.Clear(buffers[i], 0, buffers[i].Length);
2) public void NextBuffer()
wrong:
//if (1 + bufferUpto == buffers.Length)
//byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
//Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
should be:
if (1 + bufferUpto == buffers.GetLength(0))
byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
2)class CharBlockPool
1)public void NextBuffer()
wrong:
//if (1 + bufferUpto == buffers.Length){
//char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
//Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
should be:
if (1 + bufferUpto == buffers.GetLength(0)){
char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (LUCENENET-145) Bug in documentswriter.cs
Posted by "Iliev Andrei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENENET-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Iliev Andrei resolved LUCENENET-145.
------------------------------------
Resolution: Fixed
Replace the code in DocumentsWriter.cs
1)class ByteBlockPool.
1) Method Reset()
wrong:
//Array.Clear(buffers[i], 0, buffers.Length);
should be:
Array.Clear(buffers[i], 0, buffers[i].Length);
2) public void NextBuffer()
wrong:
//if (1 + bufferUpto == buffers.Length)
//byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
//Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
should be:
if (1 + bufferUpto == buffers.GetLength(0))
byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
2)class CharBlockPool
1)public void NextBuffer()
wrong:
//if (1 + bufferUpto == buffers.Length){
//char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
//Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
should be:
if (1 + bufferUpto == buffers.GetLength(0)){
char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
> Bug in documentswriter.cs
> -------------------------
>
> Key: LUCENENET-145
> URL: https://issues.apache.org/jira/browse/LUCENENET-145
> Project: Lucene.Net
> Issue Type: Bug
> Reporter: Iliev Andrei
> Priority: Critical
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Bad conversion from java source code. For multiple dimention array .length in java returns the number of dimensions. In c# .Length - returns the total number of elements in all dimensions. This bug sometimes lead to IndexOutOfRangeException as reported in http://www.mail-archive.com/lucene-net-dev@incubator.apache.org/msg01277.html
> See the follwing code:
> 1)class ByteBlockPool.
> 1) Method Reset()
> wrong:
> //Array.Clear(buffers[i], 0, buffers.Length);
> should be:
> Array.Clear(buffers[i], 0, buffers[i].Length);
> 2) public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length)
> //byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0))
> byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
> 2)class CharBlockPool
> 1)public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length){
> //char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0)){
> char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LUCENENET-145) Bug in documentswriter.cs
Posted by "Digy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENENET-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Digy updated LUCENENET-145:
---------------------------
Attachment: DocumentsWriter.patch
I will attach a patch including LUCENENET-142.
DIGY
> Bug in documentswriter.cs
> -------------------------
>
> Key: LUCENENET-145
> URL: https://issues.apache.org/jira/browse/LUCENENET-145
> Project: Lucene.Net
> Issue Type: Bug
> Reporter: Iliev Andrei
> Priority: Critical
> Attachments: DocumentsWriter.patch
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Bad conversion from java source code. For multiple dimention array .length in java returns the number of dimensions. In c# .Length - returns the total number of elements in all dimensions. This bug sometimes lead to IndexOutOfRangeException as reported in http://www.mail-archive.com/lucene-net-dev@incubator.apache.org/msg01277.html
> See the follwing code:
> 1)class ByteBlockPool.
> 1) Method Reset()
> wrong:
> //Array.Clear(buffers[i], 0, buffers.Length);
> should be:
> Array.Clear(buffers[i], 0, buffers[i].Length);
> 2) public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length)
> //byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0))
> byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
> 2)class CharBlockPool
> 1)public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length){
> //char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0)){
> char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LUCENENET-145) Bug in documentswriter.cs
Posted by "Digy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENENET-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647953#action_12647953 ]
Digy commented on LUCENENET-145:
--------------------------------
Patch applied.
DIGY
> Bug in documentswriter.cs
> -------------------------
>
> Key: LUCENENET-145
> URL: https://issues.apache.org/jira/browse/LUCENENET-145
> Project: Lucene.Net
> Issue Type: Bug
> Reporter: Iliev Andrei
> Priority: Critical
> Attachments: DocumentsWriter.patch
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Bad conversion from java source code. For multiple dimention array .length in java returns the number of dimensions. In c# .Length - returns the total number of elements in all dimensions. This bug sometimes lead to IndexOutOfRangeException as reported in http://www.mail-archive.com/lucene-net-dev@incubator.apache.org/msg01277.html
> See the follwing code:
> 1)class ByteBlockPool.
> 1) Method Reset()
> wrong:
> //Array.Clear(buffers[i], 0, buffers.Length);
> should be:
> Array.Clear(buffers[i], 0, buffers[i].Length);
> 2) public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length)
> //byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0))
> byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
> 2)class CharBlockPool
> 1)public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length){
> //char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0)){
> char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (LUCENENET-145) Bug in documentswriter.cs
Posted by "Iliev Andrei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENENET-145?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Iliev Andrei closed LUCENENET-145.
----------------------------------
> Bug in documentswriter.cs
> -------------------------
>
> Key: LUCENENET-145
> URL: https://issues.apache.org/jira/browse/LUCENENET-145
> Project: Lucene.Net
> Issue Type: Bug
> Reporter: Iliev Andrei
> Priority: Critical
> Attachments: DocumentsWriter.patch
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Bad conversion from java source code. For multiple dimention array .length in java returns the number of dimensions. In c# .Length - returns the total number of elements in all dimensions. This bug sometimes lead to IndexOutOfRangeException as reported in http://www.mail-archive.com/lucene-net-dev@incubator.apache.org/msg01277.html
> See the follwing code:
> 1)class ByteBlockPool.
> 1) Method Reset()
> wrong:
> //Array.Clear(buffers[i], 0, buffers.Length);
> should be:
> Array.Clear(buffers[i], 0, buffers[i].Length);
> 2) public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length)
> //byte[][] newBuffers = new byte[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0))
> byte[][] newBuffers = new byte[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
> 2)class CharBlockPool
> 1)public void NextBuffer()
> wrong:
> //if (1 + bufferUpto == buffers.Length){
> //char[][] newBuffers = new char[(int) (buffers.Length * 1.5)][];
> //Array.Copy(buffers, 0, newBuffers, 0, buffers.Length);
> should be:
> if (1 + bufferUpto == buffers.GetLength(0)){
> char[][] newBuffers = new char[(int)(buffers.GetLength(0) * 1.5)][];
> Array.Copy(buffers, 0, newBuffers, 0, buffers.GetLength(0));
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.