Hi Shai,

I finally managed to solve my issue and I think I found a bug in the 
codenameone library.
The problem wasn't related to server session but is a conversion problem in 
the Result class.

    public long getAsLong(final String path) throws 
IllegalArgumentException {
        String s = getAsString(path);
        if (s == null) {
            return 0;
        }
        return new Double(Double.parseDouble(s)).longValue();
    }

is buggy !!!!

try to convert a large value i.e. '636384734479955370' and you'll get as 
long value 636384734479955328, due to the rounding from double conversion.
Simply using  Long.parseLong() returns the correct value.
I see that the getAsInteger uses a double conversion too but I didn't tried 
any (may be there is non round error due to the integer ranger)

I have replaced all the 
long value= result.getAsLong(path);
with
long value= Long.parseLong(result.getAsString(path));

and now my application is working fine as before the plugin update

Hope this could help
Regards
Nicola

Il giorno lunedì 14 agosto 2017 18:32:22 UTC+2, Nicola Dell'Amico ha 
scritto:
>
> Hi,
> I have a couple of application running on Android.
> They access to different webservice hosted in Windows machine , and that 
> woarked fine until the last Netbeans Codenameone plugin update.
> Now when I try to access the webservice specifying the address as http , I 
> get a '500 Internal server error'
> I tried to install a self signed ssl certificate into the server and when 
> when I try to access the webservice specifying the address as https I get 
> the following exception :
> 'javax.net.ssl.SSLHandshakeException: 
> java.security.cert.CertificateException: No subject alternative names 
> present'
>
> I think It's a certificate issue.
>
> Both methods (http and https) work fine from Firefox and Chromium 
> (manually trusting the certificate when using https).
>
> I tried some tips read from the net .
> I.e.
> added the build hint 
> ios.plistinject=<key>NSAppTransportSecurity</key><dict><key>NSAllowsArbitraryLoads</key><true/></dict><key>CFBundleURLTypes</key>
>  
> <array> <dict> <key>CFBundleURLName</key> 
> <string>it.vtsystem.sigemmobile.SIGEMMobile</string> </dict> <dict> 
> <key>CFBundleURLSchemes</key> <array> <string>SIGEMMobile</string> </array> 
> </dict> </array>
>
> I tried some methods to disable the java check 
>         javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
>                         new javax.net.ssl.HostnameVerifier() {
>
>
>                             public boolean verify(String hostname,
>                                     javax.net.ssl.SSLSession sslSession) {
>                                 return hostname.equals("localhost");
>                             }
>                         });
>
>
>
>
> and 
>
> private static void disableSslVerification() {
>         try {
>             // Create a trust manager that does not validate certificate 
> chains
>             TrustManager[] trustAllCerts = new TrustManager[]{new 
> X509TrustManager() {
>                 public java.security.cert.X509Certificate[] 
> getAcceptedIssuers() {
>                     return null;
>                 }
>
>
>                 public void checkClientTrusted(X509Certificate[] certs, 
> String authType) {
>                 }
>
>
>                 public void checkServerTrusted(X509Certificate[] certs, 
> String authType) {
>                 }
>             }
>             };
>
>
>             // Install the all-trusting trust manager
>             SSLContext sc = SSLContext.getInstance("SSL");
>             sc.init(null, trustAllCerts, new java.security.SecureRandom
> ());
>             HttpsURLConnection.setDefaultSSLSocketFactory(sc.
> getSocketFactory());
>
>
>             // Create all-trusting host name verifier
>             HostnameVerifier allHostsValid = new HostnameVerifier() {
>                 public boolean verify(String hostname, SSLSession session) 
> {
>                     return true;
>                 }
>             };
>
>
>             // Install the all-trusting host verifier
>             HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
>         } catch (NoSuchAlgorithmException e) {
>             e.printStackTrace();
>         } catch (KeyManagementException e) {
>             e.printStackTrace();
>         }
>     }
>
>
> but I cannot compile any of the 2 with codenameone (not investigated too 
> much ...)
>
> I should like to continue using http (I'm NOT concerned with IOS builds)
>
> Please give me back the last functioning plugin
> or let me know how to solve 
>
> I have a customer pressing for a bug-fix and I cannot have a running 
> application .... and I's holiday time too !!!!
> Please helpppppppp !!!!!!
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/0fb74ff5-9b5b-444b-8b57-0c103f3f5c67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to