Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Plugin Crashes App on Android If Config-file Url Is Wrong #88

Closed
johnmiroki opened this issue Jan 13, 2016 · 2 comments
Closed

Plugin Crashes App on Android If Config-file Url Is Wrong #88

johnmiroki opened this issue Jan 13, 2016 · 2 comments

Comments

@johnmiroki
Copy link

Before my admin adjust the server, I tested app by setting the config-file to the url to be used on the server, which happens to redirect to the index.html of an SPA (basically the web page version of my app), the app crashes. Here's the log:

D/CHCP    ( 3961): Starting loader worker
D/WebViewDraw( 3961): callDrawGLFunction2 method doesn't exist
W/System.err( 3961): com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
W/System.err( 3961):  at [Source: <!DOCTYPE html>
W/System.err( 3961): <html>
W/System.err( 3961): <head>
W/System.err( 3961): <meta charset="utf-8">
W/System.err( 3961): <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
W/System.err( 3961): <title></title>
W/System.err( 3961): <link href="css/style.css" rel="stylesheet">
W/System.err( 3961): <link rel="stylesheet" type="text/css" href="css/timeshaft/default.css" />
W/System.err( 3961): <link rel="stylesheet" type="text/css" href="css/timeshaft/component.css" />
W/System.err( 3961): <link href="lib/ionic/css/ionic.css" rel="stylesheet">
W/System.err( 3961): <link href="css/angular-chart.min.css" rel="stylesheet">
W/System.err( 3961): <link rel="stylesheet" type="text/css" href="css/pingan.css" />
W/System.err( 3961): <script src="lib/modernizr.custom.js"></script>
W/System.err( 3961): <script data-main="js/main" src="lib/require.js"></script>
W/System.err( 3961): <!-- <script src="cordova.js"></script> -->
W/System.err( 3961): <script type="text/javascript">
W/System.err( 3961):       // 调试代码
W/System.err( 3961):       window.onerror = function(msg, url, line) {
W/System.err( 3961):         var idx = url.lastIndexOf("/");
W/System.err( 3961):         alert("ERROR in " + url + " (line #" + line + "): " + msg);
W/System.err( 3961):         return false;
W/System.err( 3961):       };
W/System.err( 3961): </script>
W/System.err( 3961): <div style="display:none">
W/System.err( 3961): <script src="http://s11.cnzz.com/z_stat.php?id=1257060790&web_id=1257060790" language="JavaScript"></script>
W/System.err( 3961): </div>
W/System.err( 3961): </head>
W/System.err( 3961): <body style="max-width:750px">
W/System.err( 3961):    <ion-nav-view></ion-nav-view>
W/System.err( 3961): </body>
W/System.err( 3961): </html>
W/System.err( 3961): ; line: 1, column: 2]
W/System.err( 3961):    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
W/System.err( 3961):    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
W/System.err( 3961):    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:437)
W/System.err( 3961):    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1462)
W/System.err( 3961):    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683)
W/System.err( 3961):    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3105)
W/System.err( 3961):    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
W/System.err( 3961):    at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1833)
W/System.err( 3961):    at com.nordnetab.chcp.main.config.ApplicationConfig.fromJson(ApplicationConfig.java:48)
W/System.err( 3961):    at com.nordnetab.chcp.main.network.ApplicationConfigDownloader.createInstance(ApplicationConfigDownloader.java:26)
W/System.err( 3961):    at com.nordnetab.chcp.main.network.ApplicationConfigDownloader.createInstance(ApplicationConfigDownloader.java:13)
W/System.err( 3961):    at com.nordnetab.chcp.main.network.JsonDownloader.download(JsonDownloader.java:50)
W/System.err( 3961):    at com.nordnetab.chcp.main.network.ApplicationConfigDownloader.download(ApplicationConfigDownloader.java:13)
W/System.err( 3961):    at com.nordnetab.chcp.main.updater.UpdateLoaderWorker.downloadApplicationConfig(UpdateLoaderWorker.java:165)
W/System.err( 3961):    at com.nordnetab.chcp.main.updater.UpdateLoaderWorker.run(UpdateLoaderWorker.java:75)
W/System.err( 3961):    at com.nordnetab.chcp.main.updater.UpdatesLoader$1.run(UpdatesLoader.java:61)
W/System.err( 3961):    at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime( 3961): FATAL EXCEPTION: Thread-1782
E/AndroidRuntime( 3961): Process: org.trustutn.shuidi, PID: 3961
E/AndroidRuntime( 3961): java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.nordnetab.chcp.main.config.ContentConfig.getReleaseVersion()' on a null object reference
E/AndroidRuntime( 3961):        at com.nordnetab.chcp.main.updater.UpdateLoaderWorker.run(UpdateLoaderWorker.java:82)
E/AndroidRuntime( 3961):        at com.nordnetab.chcp.main.updater.UpdatesLoader$1.run(UpdatesLoader.java:61)
E/AndroidRuntime( 3961):        at java.lang.Thread.run(Thread.java:818)

indeed, I shouldn't have tested it with the url that's not ready. but imagine someday my server crashes and ngnix automatically redirects to a 503 error page, which I suspect may crash the app the same way.

@nikDemyankov
Copy link
Member

Agree, will fix that. Thanks for noticing.

@nikDemyankov nikDemyankov added this to the v1.2.4 milestone Jan 13, 2016
nikDemyankov added a commit that referenced this issue Jan 16, 2016
@nikDemyankov
Copy link
Member

Released in v1.2.4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants