Hey Bryce, I don't think this change is quite correct. Looks like it's converting null into an empty string. How did you run into this? Mobile spec? If it's something we need to support (looks like it is, iOS handles it at least), it'll need JS changes as well, so will need another re-tag. Worth it?
On Wed, Oct 24, 2012 at 2:37 PM, <[email protected]> wrote: > Updated Branches: > refs/heads/master 7d3afcab9 -> cba0d5902 > > > Fix exception when plugin returns a null string. > > > Project: > http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo > Commit: > http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/cba0d590 > Tree: > http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/cba0d590 > Diff: > http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/cba0d590 > > Branch: refs/heads/master > Commit: cba0d59021a2562af6888050a171d4ba3cdbe47e > Parents: 7d3afca > Author: Bryce Curtis <[email protected]> > Authored: Wed Oct 24 12:36:30 2012 -0600 > Committer: Bryce Curtis <[email protected]> > Committed: Wed Oct 24 12:36:30 2012 -0600 > > ---------------------------------------------------------------------- > .../org/apache/cordova/NativeToJsMessageQueue.java | 13 ++++++++++--- > 1 files changed, 10 insertions(+), 3 deletions(-) > ---------------------------------------------------------------------- > > > > http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/cba0d590/framework/src/org/apache/cordova/NativeToJsMessageQueue.java > ---------------------------------------------------------------------- > diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java > b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java > index 55fa205..03a69b1 100755 > --- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java > +++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java > @@ -398,7 +398,12 @@ public class NativeToJsMessageQueue { > ret += 1 + pluginResult.getMessage().length(); > break; > case PluginResult.MESSAGE_TYPE_STRING: // s > - ret += 1 + pluginResult.getStrMessage().length(); > + if (pluginResult.getStrMessage() == null) { > + ret += 1; > + } > + else { > + ret += 1 + pluginResult.getStrMessage().length(); > + } > break; > case PluginResult.MESSAGE_TYPE_JSON: > default: > @@ -433,8 +438,10 @@ public class NativeToJsMessageQueue { > .append(pluginResult.getMessage()); > break; > case PluginResult.MESSAGE_TYPE_STRING: // s > - sb.append('s') > - .append(pluginResult.getStrMessage()); > + sb.append('s'); > + if (pluginResult.getStrMessage() != null) { > + sb.append(pluginResult.getStrMessage()); > + } > break; > case PluginResult.MESSAGE_TYPE_JSON: > default: > >
