Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

webservice access after some time interval, thread exiting with uncaught exception

$
0
0

I am trying to access yahoo finance web service repeatedly on some time interval .. when i access it for 1st time it returns proper output and after the interval when it accesses 2nd time it gets null pointer exception.

my code

var getShareRates = function() { var url = "http://download.finance.yahoo.com/d/quotes.csv?s=YHOO,GOOG,MSFT,BAC,HPQ,AAPL,GTAT,MU,ITUB&f=nl1"; // var url = "http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=TCS.NS&callback=YAHOO.Finance.SymbolSuggest.ssCallback"; var xhr = Ti.Network.createHTTPClient({ onload: function(e) { // this function is called when data is returned from the server and available for use // this.responseText holds the raw text return of the message (used for text/JSON) // this.responseXML holds any returned XML (including SOAP) // this.responseData holds any returned binary data Ti.API.debug(this.responseText); // var token = (this.responseText).split(","); // alert('success' + token[2]);

//    var arr = (this.responseText).split(",");

},
onerror: function(e) {
    // this function is called when an error occurs, including a timeout
    Ti.API.debug(e.error);
    alert('error');
},
timeout:5000  /* in milliseconds */

}); xhr.open("GET", url); xhr.send(); // request is actually sent with this statement };

setInterval(getShareRates(), 5000); //getShareRates();

$.index.open();

Logcat : in debug 1st time result is fine after that thread exiting with uncaught exception

[DEBUG] : "Yahoo! Inc.",39.60 [DEBUG] : "Google Inc.",544.49 [DEBUG] : "Microsoft Corpora",44.03 [DEBUG] : "Bank of America C",16.48 [DEBUG] : "Hewlett-Packard C",33.50 [DEBUG] : "Apple Inc.",100.73 [DEBUG] : "GT Advanced Techn",0.81 [DEBUG] : "Micron Technology",27.79 [DEBUG] : "Itau Unibanco Ban",14.53 [DEBUG] : HTTPClient: The persistent handle is disposed. [WARN] : dalvikvm: threadid=11: thread exiting with uncaught exception (group=0xa4d4fb20) [ERROR] : TiApplication: (KrollRuntimeThread) [5030,5030] Sending event: exception on thread: KrollRuntimeThread msg:java.lang.NullPointerException; Titanium 3.3.0,2014/07/11 12:36,787cd39 [ERROR] : TiApplication: java.lang.NullPointerException [ERROR] : TiApplication: at ti.modules.titanium.TitaniumModule$Timer.run(TitaniumModule.java:152) [ERROR] : TiApplication: at android.os.Handler.handleCallback(Handler.java:733) [ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:136) [ERROR] : TiApplication: at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) [INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.swapnil.tabbar.TabbarapplicationActivity@5288fb18 [ERROR] : E/ : UID 10061 asks for /proc/cpuinfo [ERROR] : E/ : Unable to open file /data/data/.appwithABI2 [ERROR] : E/ : Unable to open file /data/data/.appwithABI2neon [ERROR] : E/ : UID 10061 is not in ARM UID list files [WARN] : EGL_genymotion: eglSurfaceAttrib not implemented [DEBUG] : dalvikvm: GC_CONCURRENT freed 418K, 5% free 10972K/11500K, paused 2ms+1ms, total 9ms [INFO] : Process: Sending signal. PID: 1750 SIG: 9


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>