Merge: android: click event on button release, better errors and safer `JavaString...
authorJean Privat <jean@pryen.org>
Fri, 7 Oct 2016 19:40:27 +0000 (15:40 -0400)
committerJean Privat <jean@pryen.org>
Fri, 7 Oct 2016 19:40:27 +0000 (15:40 -0400)
commit51dd733c178cd18b41e4efb013eac0cb71dad4b6
tree87707ce50cc7b2557f9445e577032e62ee58b9e9
parent0ad0cfc6e0c1cbe02d8d2a1ca6dced149b0e9e19
parentff572c611ed20202fd1431f4e1f3c44d24406e8a
Merge: android: click event on button release, better errors and safer `JavaString::to_s`

Some small tweaks to the Android support:

* `JavaString::to_s` used to crash (at the JNI level) if the associated Java string was null. This was a counterintuitive behavior when the Nit object is non-nullable. This PR prevents this error by returning something similar to the default `Object::to_s` when the underlying Java value is null (for `JavaString` and others). This makes it crash proof, but one should still check if `JavaString::is_java_null` before using the value returned by `to_s` when an actual string is expected.

* Some Java exceptions raised by the Android implementation of `http_get` do not have a message. This PR looks through the causes of such exceptions to find the first available message.

* Also, fix `on_click & ButtonPressEvent` to be raised only when a button is released (instead of at the initial touch).

Pull-Request: #2319
Reviewed-by: Romain Chanoir <romain.chanoir@viacesi.fr>
Reviewed-by: Ait younes Mehdi Adel <overpex@gmail.com>