Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17136] iOS: Passing null value to the callback on HTTPClient causes exception to be thrown on iOS

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-06-13T20:20:05.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsiOS
Labelsqe-3.3.0, regression
ReporterFederico Casali
AssigneePedro Enrique
Created2014-06-10T20:56:06.000+0000
Updated2014-07-24T20:53:49.000+0000

Description

Problem description

Using the latest TiSDK 3.3.X, Sync Server client is presenting issues when trying to login or sync. Using TiSDK 3.2.3.GA works as expected, so is a regression.

Steps to reproduce

Grab Sample code here: https://github.com/appcelerator/titanium_mobile_tests_internal/tree/master/SyncServer/Sample_CombinedDev2013 Module available in repo: https://github.com/appcelerator-modules/appcelerator.syncserver.client Note: the updated sample code comes from the BasicSync sample code included in the module example folder with the following modifications: In app.js, change credentials to:
		var credentials = {
		"user": "admin@eagentmobile2013.onmicrosoft.com",
	    "password": "Combined1"
		};	
		
In syncConfig.js, the following code is used:
		{
	"connectors": {
		"msDynamicsCrm1.0": {
			"apis": {
				"login": "/api/1.0/msDynamicsCrm1.0/login",
				"logout": "/api/1.0/msDynamicsCrm1.0/logout",
				"verifysession": "/api/1.0/msDynamicsCrm1.0/verifysession",
				"update-details": "/api/1.0/msDynamicsCrm1.0/update-details",
				"get-details": "/api/1.0/msDynamicsCrm1.0/get-details"
			},
			"appId": "combined-dev-2013",
			"serverAddress": "http://e80189ea2413d9bb303c7095fc2bde12af543e0f.dev.ace.appcelerator.com",
			"databaseName": "DBTEST",
			"retryAttempts": 1,
			"autoResume": true,
			"models": [{
				"modelName": "contact",
				"idAttribute": "contactid",
				"syncOptions": {
					"queryName": "PowerName",
					"queryParameters": {
						"statecode": 0
					}
				}
			}]
		}
	}
}
		

iOS

1. Build and run on device or simulator 2. Click on Login Result: Application Error screen is displayed with "Invalid type passed to function at appcelerator.syncserver.client" error message. See "screenshot_iOS.png" attached and attached log "log_iOS_login.txt". Looking at the logs it seems that the login process is actually performed successfully. However, an Application Error is shown. 3. Click on Sync Result: Application Error screen is displayed with "Invalid type passed to function at appcelerator.syncserver.client" error message. See "screenshot_iOS.png" attached and attached log "log_iOS_sync.txt". Looking at the logs it seems that the login and sync processes are actually performed successfully. However, an Application Error is shown.

Android

5. Build/run on device or on simulator 6. Click on Login Result: no error is displayed on screen. However, the logs are displaying a failure authenticating. See attached "log_Android_login.txt" In particular:
I/TiAPI   ( 1489):  Login Progress: {
I/TiAPI   ( 1489):   "errorCode": -15001,
I/TiAPI   ( 1489):   "message": "Unexpected token \u001f",
I/TiAPI   ( 1489):   "method": "sendRequest",
I/TiAPI   ( 1489):   "state": "loginFailed"
I/TiAPI   ( 1489): }
7. Click on Sync Result: no error is displayed on screen. However, the logs are displaying a failure authenticating and syncing. See attached "log_Android_sync.txt" In particular:
D/skia    ( 1489): --- SkImageDecoder::Factory returned null
W/System.err( 1489): java.lang.NullPointerException
W/System.err( 1489): 	at ti.modules.titanium.network.TiHTTPClient.getResponseHeader(TiHTTPClient.java:772)
W/System.err( 1489): 	at ti.modules.titanium.network.HTTPClientProxy.getResponseHeader(HTTPClientProxy.java:93)
W/System.err( 1489): 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method)
W/System.err( 1489): 	at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:69)
W/System.err( 1489): 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1121)
W/System.err( 1489): 	at android.os.Handler.dispatchMessage(Handler.java:95)
W/System.err( 1489): 	at android.os.Looper.loop(Looper.java:137)
W/System.err( 1489): 	at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
E/V8Exception( 1489): Exception occurred at appcelerator.syncserver.client:16: Uncaught Error: Java Exception occurred
I/TiAPI   ( 1489):  Sync Progress: {
I/TiAPI   ( 1489):   "errorCode": -15001,
I/TiAPI   ( 1489):   "message": "Unexpected token \u001f",
I/TiAPI   ( 1489):   "method": "sendRequest",
I/TiAPI   ( 1489):   "state": "loginFailed"
I/TiAPI   ( 1489): }
D/TiAPI   ( 1489):  <progress> : {"errorCode":-15001,"message":"Unexpected token \u001f","method":"sendRequest","state":"loginFailed"}
I/TiAPI   ( 1489):  Sync Progress: {
I/TiAPI   ( 1489):   "errorCode": -15001,
I/TiAPI   ( 1489):   "message": "Unexpected token \u001f",
I/TiAPI   ( 1489):   "method": "sendRequest",
I/TiAPI   ( 1489):   "state": "syncFailed"
I/TiAPI   ( 1489): }

Attachments

FileDateSize
authentication_error.txt2014-07-18T21:13:06.000+00006663
log_Android_login.txt2014-06-10T20:56:06.000+00002016
log_Android_sync.txt2014-06-10T20:56:06.000+00003895
log_iOS_login.txt2014-06-10T20:56:06.000+00003388
log_iOS_sync.txt2014-06-10T20:56:06.000+00006088
screenshot_iOS.png2014-06-10T20:56:06.000+000053154

Comments

  1. Neeraj Gupta 2014-06-11

    This is most likely a regression introduced with 3.3.0 SDK as just switching the Titanium SDK in tiapp.xml from 3.3.0 to 3.2.3 made the entire flow work.
  2. Ingo Muschenetz 2014-06-11

    [~penrique], can you please take a look?
  3. Sabil Rahim 2014-06-11

    Fix for iOS issue : https://github.com/appcelerator/titanium_mobile/pull/5791
  4. Hieu Pham 2014-06-12

  5. Sabil Rahim 2014-06-13

    3_3_X : https://github.com/appcelerator/titanium_mobile/pull/5798
  6. Wilson Luu 2014-07-18

    After running the above sample app with the sync server module on both iOS and Android, I *do not* see the "Invalid type" error for iOS and I *do not* see the NullPointerException on Android. *However*, after using different credentials to authenticate (from this ticket and from Jon), I still get authentication failure from the server (see authentication_error.txt). Tested on: Appcelerator Studio, build: 3.3.0.201407111535 SDK build: 3.3.0.GA CLI: 3.3.0 Alloy: 1.4.0 Xcode: 5.1.1 Devices: Nexus 5 (4.4), iphone 5 (7.1)
  7. Neeraj Gupta 2014-07-19

    [~wluu] I see your update here but no change to the ticket status. Since you did not reopen this ticket, did you open another ticket to track your reported issue?
  8. Wilson Luu 2014-07-24

    Closing ticket as fixed now. After getting the correct credentials and server url from Radamantis, I was able to verify that the "Invalid type" error for iOS does not appear and the NullPointerException does not appear on Android after properly authenticating. Tested on: Appcelerator Studio, build: 3.3.0.201407111535 SDK build: 3.3.0.GA CLI: 3.3.0 Alloy: 1.4.0 Xcode: 5.1.1 Devices: Nexus 5 (4.4), iphone 5 (7.1.1)

JSON Source