Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4718] Android: CharacterData.substringData - If the sum of offset and count exceeds the length exception is thrown instead of returning entire string

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-11-05T14:33:19.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sSprint 2011-30, Release 1.8.0
ComponentsAndroid
Labelsn/a
ReporterNatalie Huynh
AssigneeBill Dawson
Created2011-07-19T11:32:29.000+0000
Updated2011-11-05T14:33:19.000+0000

Description

Steps to Reproduce: 1. Run XML test case for drillbit Actual Result: CData fails when the sum of offset and count exceeds length Expected Result: Should return the entire string

Comments

  1. Bill Dawson 2011-07-27

    From the trace (below) it looks like Harmony is non-compliant. Spec says if "If the sum of offset and count exceeds the length, then all 16-bit units to the end of the data are returned." So it looks like we'll have to take care of this for Harmony :( .
       E/KrollMethod(21962): java.lang.StringIndexOutOfBoundsException: start=1 end=1001 length=97
       E/KrollMethod(21962): 	at java.lang.AbstractStringBuilder.startEndAndLength(AbstractStringBuilder.java:218)
       E/KrollMethod(21962): 	at java.lang.AbstractStringBuilder.substring(AbstractStringBuilder.java:630)
       E/KrollMethod(21962): 	at java.lang.StringBuffer.substring(StringBuffer.java:718)
       E/KrollMethod(21962): 	at org.apache.harmony.xml.dom.CharacterDataImpl.substringData(CharacterDataImpl.java:93)
       E/KrollMethod(21962): 	at ti.modules.titanium.xml.CharacterDataProxy.substringData(CharacterDataProxy.java:62)
       E/KrollMethod(21962): 	at ti.modules.titanium.xml.CharacterDataProxyBindingGen$10.invoke(CharacterDataProxyBindingGen.java:471)
       
  2. Bill Dawson 2011-07-29

    Pull req ready https://github.com/appcelerator/titanium_mobile/pull/297
  3. Don Thorp 2011-07-29

    reviewed and tested.
  4. Natalie Huynh 2011-08-26

    Tested with: version=1.8.0 timestamp=08/26/11 14:21 githash=0e2031e Android Emulator 2.1 and 3.2
  5. Don Thorp 2011-11-05

    Standardizing summary and labels.

JSON Source