Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17136

iOS: Passing null value to the callback on HTTPClient causes exception to be thrown on iOS

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 3.3.0
    • Fix Version/s: Release 3.3.0, Release 3.4.0
    • Component/s: iOS
    • Environment:

      TiSDk 3.3.0.v2014060918491
      Appcelerator Studio 3.3.0.201406061445
      Appcelerator SyncServer Client module version 1.4.0
      CLI 3.3.0-rc
      Alloy 1.4.0-rc
      ACS 1.0.14

    • Sprint:
      2014 Sprint 12 SDK

      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

        1. authentication_error.txt
          7 kB
        2. log_Android_login.txt
          2 kB
        3. log_Android_sync.txt
          4 kB
        4. log_iOS_login.txt
          3 kB
        5. log_iOS_sync.txt
          6 kB
        6. screenshot_iOS.png
          screenshot_iOS.png
          52 kB

          Activity

            People

            • Assignee:
              penrique Pedro Enrique (Inactive)
              Reporter:
              fcasali Federico Casali
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-18834
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration