Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14717] BlackBerry: Crash with Ti.App.Properties.getString()

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-07-31T16:02:25.000+0000
Affected Version/sRelease 3.1.1
Fix Version/sn/a
ComponentsBlackBerry
Labelsblackberry, crash, properties
ReporterBrent Barbata
AssigneePedro Enrique
Created2013-07-30T23:08:08.000+0000
Updated2017-03-16T20:25:49.000+0000

Description

The following line (alone) will crash the BlackBerry simulator if the property cannot be found. (In this case, the property name is "Credentials".)
var storedCredentials = JSON.parse(Ti.App.Properties.getString("Credentials"));
However, if we set the property/value pair using setString() and then try getString(), everything works fine. For example, this will work:
// Build json string
oCredentials = new Object();
oCredentials.username = "some username";
oCredentials.password = "some password";
var stringCredentials = JSON.stringify(oCredentials);
				
// Save credentials
Ti.App.Properties.setString("Credentials", stringCredentials);

// Read the credentials
var storedCredentials = JSON.parse(Ti.App.Properties.getString("Credentials"));

Comments

  1. Pedro Enrique 2013-07-31

    I do not see a crash, I see message
       Unexpected token u
       
    This appears when trying to JSON.stringify an undefined value. Same thing happens in a node.js console:
       > JSON.parse(undefined)
       SyntaxError: Unexpected token u
           at Object.parse (native)
           at repl:1:7
           at REPLServer.self.eval (repl.js:109:21)
           at Interface.<anonymous> (repl.js:248:12)
           at Interface.EventEmitter.emit (events.js:96:17)
           at Interface._onLine (readline.js:200:10)
           at Interface._line (readline.js:518:8)
           at Interface._ttyWrite (readline.js:736:14)
           at ReadStream.onkeypress (readline.js:97:10)
           at ReadStream.EventEmitter.emit (events.js:126:20)
       > 
       
  2. Lee Morris 2017-03-16

    Closing ticket as BlackBerry is no longer supported by us.

JSON Source