HTTP question in Android, getting SSL error and when ignoring Locale error

I am trying to issue a HTTP request to get some JSON data and leverage it in my Android application only the moment I am adding the code which retrieves data of which the logic is defined in a SharedProject:

An exception occurred in XAndroid, thread 0114 ()

Type: java.lang.IllegalAccessException

Message:

java.lang.Class<com.android.org.conscrypt.OpenSSLSocketFactoryImpl> is not accessible from java.lang.Class<javax.net.ssl.SSLSocketFactory>

Call Stack:

0000000000000000 , Class.newInstance() ( 0)
0000000000000000 , SSLSocketFactory.getDefault() (SSLSocketFactory.java 138)
0000000000000000 , HttpsURLConnection.getDefaultSSLSocketFactory() (HttpsURLConnection.java 343)
0000000000000000 , HttpsHandler.createHttpsOkUrlFactory() (HttpsHandler.java 92)
0000000000000000 , HttpsHandler.newOkUrlFactory() (HttpsHandler.java 53)
0000000000000000 , HttpHandler.openConnection() (HttpHandler.java 44)
0000000000000000 , URL.openConnection() ( 0)
0000000000000000 , Http$1.$ExecuteRequest$b__0() ( 0)
0000000000000000 , Http$2.run() ( 0)
0000000000000000 , Task.run() ( 0)
0000000000000000 , ThreadPoolExecutor.runWorker() ( 0)
0000000000000000 , ThreadPoolExecutor$Worker.run() ( 0)
0000000000000000 , Thread.run() ( 0)

now I can continue this exception and have to admit not sure why I can continue this but then I am getting this exception where it says an illegal argument is given for Currency. I am not sure where this is coming from.

If I look at the call stack it looks something is happening in JsonDeserializer's ReadValue-method but when I look into the source of this method at https://github.com/remobjects/RTL2/blob/daa5908eff18f181fa2492dbe4e1acf7334b0e45/Source/Json/JsonDeserializer.pas#L120. I am unable to find a reference to Locale or Currency. I assume it’s the call to Convert.ToDoubleInvariant.

I am wondering this exception is triggered by https://github.com/remobjects/RTL2/blob/3b9cf4ab0634586063e1922f21f9b5b9df504f3b/Source/Convert.pas#L629?

Do I need to do something special in Android? Maybe I need to run the emulator in a special way? Currently, it’s being ran as: /Users/x/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_27_x86 -verbose. Do I need to force my application with a specific Locale?

An exception occurred in XAndroid, thread 0135 ()

Type: java.lang.IllegalArgumentException

Message:

Unsupported ISO 3166 country: 

Call Stack:

0000000000000000 , Currency.getInstance() ( 0)
0000000000000000 , Locale.<init>() ( 0)
0000000000000000 , Locale.getInvariant() ( 0)
0000000000000000 , JsonDeserializer.ReadValue() ( 0)
0000000000000000 , JsonDeserializer.ReadPropery() ( 0)
0000000000000000 , JsonDeserializer.ReadProperties() ( 0)
0000000000000000 , JsonDeserializer.ReadObject() ( 0)
0000000000000000 , JsonDeserializer.ReadValue() ( 0)
0000000000000000 , JsonDeserializer.ReadValues() ( 0)
0000000000000000 , JsonDeserializer.ReadArray() ( 0)
0000000000000000 , JsonDeserializer.Deserialize() ( 0)
0000000000000000 , JsonDocument.FromBinary() ( 0)
0000000000000000 , HttpResponse$7.$GetContentAsJson$b__0() ( 0)
0000000000000000 , HttpResponse$8.Invoke() ( 0)
0000000000000000 , HttpResponse$3.$GetContentAsBinary$b__0() ( 0)
0000000000000000 , HttpResponse$4.run() ( 0)
0000000000000000 , Task.run() ( 0)
0000000000000000 , ThreadPoolExecutor.runWorker() ( 0)
0000000000000000 , ThreadPoolExecutor$Worker.run() ( 0)
0000000000000000 , Thread.run() ( 0)

The JSON works happily in iOS version of the application. I am not sure how I can properly debug this on the Android things. The JSON I am trying to request is nothing special and doesn’t use Double just: for example:

        "id": 129839,
        "organisationId": 2013,
        "parentId": 129838,

Is this actually fatal? Java throws three billion exceptions a minute during normal operation, and that’s “normal”, as long as they get handled somewhere up the stack…

This one should have been fixed a week ago or so… are you using latest elements.jar?

Actually, looks like this wasn’t merged yet. My bad. Please retest with the next build (20190425-190409-elements-develop or later), when it’s done.

Is this actually fatal? Java throws three billion exceptions a minute during normal operation, and that’s “normal”, as long as they get handled somewhere up the stack…

Yeah, doesn’t appear to be fatal as I can continue in from within Fire’s debugger. I have hit Ignore and continue now :slight_smile: I keep forgetting what you say about exceptions in Android lol. Do you have a list of useful exceptions to ignore?

This one should have been fixed a week ago or so… are you using latest elements.jar?
Actually, looks like this wasn’t merged yet. My bad. Please retest with the next build ( 20190425-190409-elements-develop or later), when it’s done.

Cool, I will definitely check the new build!

Nope. all the super-common ones are ignored by default; the rest, I just add em as I see em (but it’s a fine balance, as many exceptions that happen routinely MIGHT also happen “actually unexpected”)…

1 Like

Looks like the latest build fix the issue with the Locale/Currency. Great!!!
Now I am having some other issue related to Result-enum but first trying to find out if I am doing something wrong :slight_smile:

1 Like