Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11969] CLI: error when building if there is only a numeric value in strings.xml

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-12-07T00:48:47.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sRelease 3.0.0, Release 3.1.0, 2012 Sprint 25, 2012 Sprint 25 JS
ComponentsCLI
Labelsmodule_cli, qe-manualtest, triage
ReporterDaniel Sefton
AssigneeChris Barber
Created2012-12-05T11:25:01.000+0000
Updated2014-08-13T09:57:07.000+0000

Description

*Problem description* Building the app with Ti Studio 3.0 RC and Ti SDK 3.0 RC produces the following error when there is a numeric only value in strings.xml:
[ERROR] Unable to run command "build"

TypeError: Object 2355323623 has no method 'replace' 0 [ 'TypeError: Object 2355323623 has no method \'replace\'',
  '    at build.compileI18N.Object.keys.map.add.appname (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/iphone/cli/commands/_build.js:1512:30)',
  '    at Array.map (native)',
  '    at Object.build.compileI18N.Object.keys.map.add.appname (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/iphone/cli/commands/_build.js:1510:64)',
  '    at exports.hitch (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/node-appc/lib/util.js:59:17)',
  '    at async.parallel.results (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:454:21)',
  '    at _asyncMap (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:185:13)',
  '    at async.forEach (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:86:13)',
  '    at Array.forEach (native)',
  '    at _forEach (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:26:24)',
  '    at async.forEach (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:85:9)',
  '---------------------------------------------',
  '    at Object.exports.execFile [as execFile] (child_process.js:594:9)',
  '    at exports.exec (child_process.js:481:18)',
  '    at exports.detect.async.series.cached (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/node-appc/lib/android.js:81:4)',
  '    at async.series.results (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:486:21)',
  '    at _asyncMap (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:185:13)',
  '    at async.forEachSeries.iterate (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:108:13)',
  '    at async.forEachSeries.iterate (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:119:25)',
  '    at _asyncMap (/Users/USR/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:187:17)',
  '---------------------------------------------',
  '    at Object.exports.execFile [as execFile] (child_process.js:594:9)',
*Note* Does not happen in any mobile SDK with Ti Studio 2.1.2. In Ti Studio 3.0, it happens only with mobile SDK 3.0, not with 2.1.4 GA. *strings.xml*
<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="welcome_message">2355323623</string>
    <string name="aboutCopyrightPhone">98376349768346</string>
</resources>
*app.js*
var win = Ti.UI.createWindow();

var alert = Titanium.UI.createAlertDialog({
	title : L('aboutCopyrightPhone'),
	message : L('welcome_message'),
	buttonNames : ['Ok'],
	cancel : 0
});
alert.show();

win.open();

Comments

  1. Daniel Sefton 2012-12-05

    Hi Konstantinos. Please can you provide more information? iOS/android version, device and/or simulator, Xcode version if iOS, any logs, and also what the Javascript looks like when you're referencing the localized string (I used L()). Feel free to try the test case I added in the description. I tried it myself and cannot reproduce it on 3.0.0 RC, 2.1.4 GA or 3.1.0 master on either iOS or Android. Thanks!
  2. Konstantinos Roussos 2012-12-05

    Hello, I use xCode 4.5, Titanium Studio 3.0.0RC and Titanium SDK 3.0.0RC It is not necessary to use any L('aboutCopyrightPhone'). If I have this in my string.xml: 123456789 I get this: [ERROR] Unable to run command "build" TypeError: Object 123456789 has no method 'replace' 0 [ 'TypeError: Object 123456789 has no method \'replace\'', ' at build.compileI18N.Object.keys.map.add.appname (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/iphone/cli/commands/_build.js:1512:30)', ' at Array.map (native)', ' at Object.build.compileI18N.Object.keys.map.add.appname (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/iphone/cli/commands/_build.js:1510:64)', ' at exports.hitch (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/node-appc/lib/util.js:59:17)', ' at async.parallel.results (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:454:21)', ' at _asyncMap (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:185:13)', ' at async.forEach (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:86:13)', ' at Array.forEach (native)', ' at _forEach (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:26:24)', ' at async.forEach (/Users/konrous/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.v20121130200208/node_modules/async/lib/async.js:85:9)', '---------------------------------------------',.... .... .... ... In 2.1.4 it works fine...
  3. Daniel Sefton 2012-12-05

    Oh my apologies, I tested it on Studio 2.1.2 with SDK 3.0 before. I can reproduce the problem with Ti Studio 3.0 RC. Thanks.
  4. Chris Barber 2012-12-06

    Verified. Thanks for finding this bug! Fixed and will make 3.0.
  5. Chris Barber 2012-12-06

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/3539 3.0.x pull request: https://github.com/appcelerator/titanium_mobile/pull/3542
  6. Paras Mishra 2013-01-15

    Successfully build with the strings.xml having numeric values as stated above Verified on : SDK version: 3.1.0.v20130111163212, 3.0.0.GA CLI version : 3.0.22 OS : MAC OSX 10.7.5 XCode : 4.5.1

JSON Source