Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8074] Android: String.format fails in android.string Drillbit test

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-03-19T08:22:35.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsAndroid
Labelsregression
ReporterMarshall Culpepper
AssigneeJosh Roesslein
Created2012-03-18T22:07:39.000+0000
Updated2012-03-19T16:22:22.000+0000

Description

Run the android.string drillbit test for V8, and you should see this error for the stringFormat test:
should be: "Pi to 2 decimal places is 3.14", was: "null"
This might be related to the fix we made in TypeConverter.cpp around line 468 that does integer casting. String.format in Java may not accept an "int" primitive for "%f" format strings.

Comments

  1. Josh Roesslein 2012-03-18

    This was caused due to how we converted %d -> %f in the stringFormat() method. With the change to V8's conversion layer we no longer require this, but still need it for Rhino which always gives us double values. Will add a conditional to only enable this when running with Rhino runtime.
  2. Josh Roesslein 2012-03-19

    Sent [Pull Request #1738](https://github.com/appcelerator/titanium_mobile/pull/1738) to fix this regression. All test cases in android.string appear to be passing for both runtimes with this change.
  3. Natalie Huynh 2012-03-19

    Tested with version=2.0.0 module_apiversion=2 timestamp=03/19/12 16:15 githash=a1ddab3 with v8/rhino on Nexus Galaxy 4.0.2

JSON Source