Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17369] CLI: Auto-escape quotes in tiapp.xml

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-09-03T17:47:52.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsCLI
Labelsft
ReporterJoshua Rhinehart
AssigneeTim Poulsen
Created2014-07-22T21:27:34.000+0000
Updated2014-10-03T21:02:07.000+0000

Description

Using double quotes in the description field of your tiapp.xml causes errors at build-time, perhaps we could warn users not to use that character before they build the project, or escape the string if possible. See error below:
[ERROR] Failed to compile Java source files:
[ERROR]   
[ERROR] /Users/jrhinehart/Documents/Appcelerator_Studio_Workspace/8dupe_test WW/build/android/gen/com/appc/dupetestnew/_8dupe_testWwAppInfo.java:48: ';' expected
[ERROR]         	return "Test for 'Duplicate app icons on install" bug - Verified for 52.09 of MATT utility";
[ERROR]         	                                                 ^

Comments

  1. Ingo Muschenetz 2014-07-22

    I assume this also happens if you build from the CLI?
  2. Joshua Rhinehart 2014-07-22

    Yes, it occurs when building from both Studio and CLI
  3. Tim Poulsen 2014-08-25

    Note: The issue seemed to apply to only Android. In my testing with release-versions of the SDK, iOS and MobileWeb build fine when there are quotes in the description field. So the PR below escapes quotes for only Android builds. PR: https://github.com/appcelerator/titanium_mobile/pull/5986

    sample app code

       var win = Ti.UI.createWindow({
       	backgroundColor: 'white'
       });
       var lbl = Ti.UI.createLabel({
           text: Ti.App.description,
           wordWrap: true,
           top: 20, left: 10, right: 10
       });
       win.add(lbl);
       win.open();
       
    Functional test: 1. Create a new Titanium project and replace its app.js with the code above. 2. Edit the tiapp.xml to set the description to description with "double quotes" and 'single quotes' inside, even an ' unmatched apostrophe 3. Build for Android with ti build -p android. The app should build & run without errors and display a single label, which contains the contents of the description with quotes shown properly (unescaped) 4. Build for iOS and/or MobileWeb, which should likewise show the label with the string properly formatted.
  4. Tim Poulsen 2014-08-27

    PR updated per comment on the pull. For the test app, there's no need to test the single quotes as I described. But it doesn't hurt to test as shown. Code should work either way.
  5. Lokesh Choudhary 2014-10-03

    Verified the fix. Tested with double quotes, single quotes & apostrophe & didn't get any errors. Closing. Environment: Appc Studio : 3.4.0.201409261245 Ti SDK : 3.5.0.v20141002192515 Mac OSX : 10.9.4 Alloy : 1.5.1 CLI - 3.4.0 Code Processor: 1.1.1 Nexus5 - Android 4.4.4

JSON Source