Project

Profile

Help

Bug #1894

closed

IndexOutOfRangeException thrown in .NET

Added by O'Neil Delpratt over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
.NET API
Sprint/Milestone:
-
Start date:
2013-09-10
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

The purpose of the following NUnit test case is to test writing a text node only to an XdmDestination, which should fail cleanly.

 public void TestWriteTextNodeOnly()
        {
            try
            {
                Processor processor = new Processor(false);
                XQueryCompiler xpc = processor.NewXQueryCompiler();
                XQueryEvaluator s = xpc.Compile("text{'abcd'}").Load();
                XdmDestination dest = new XdmDestination();
                s.Run(dest);
                Assert.Fail("Unexpected success");
            }
            catch (Exception e)
            {
                Assert.True(e.Message.Contains("text nodes are only allowed within a document"), e.Message);
            }

However the test case fails with the following exception:

System.IndexOutOfRangeException occurred HResult=-2146233080
  Message=Index was outside the bounds of the array.
  Source=saxon9ee
  StackTrace:
       at net.sf.saxon.tree.tiny.TinyBuilder.makeTextNode(CharSequence chars, Int32 len)
  InnerException: 

The failure occurs on line 394 of makeTextNode in the class TinyBuilder

Actions #1

Updated by O'Neil Delpratt over 8 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Bug fixed and committed to subversion in the class Destination.cs

In the Java code base the xdmDestination wraps a TreeProtector object to the receiver. TreeProtector is a filter that ensures that the events reaching the Builder constitute a single tree rooted at an element or document node (because anything else will crash the builder as in the case of this test).

Actions #2

Updated by O'Neil Delpratt over 8 years ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 9.5.1.3

Big fix applied in the Saxon 9.5.1.3 maintenance release.

Please register to edit this issue

Also available in: Atom PDF