Java Question HttpsURLConnection error on release mode

analizer3816

Member
Licensed User
Longtime User
I create library with use HttpsURLConnection, I test with debug mode(b4a) it works well
but release mode(b4a) it shows error >> con null object

please help me

B4X:
public String webConnect(String siteUrl, Map<String, String> customProperties) throws IOException, ReCaptchaException {
                URL url = new URL(siteUrl);
                HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
                BufferedReader in = null;
                StringBuilder response = new StringBuilder();

                try {
                    con.setRequestMethod("GET");
                    con.setRequestProperty("User-Agent", USER_AGENT);

                    in = new BufferedReader(
                            new InputStreamReader(con.getInputStream()));
                    String inputLine;

                    while((inputLine = in.readLine()) != null) {
                        response.append(inputLine);
                    }
                } catch(UnknownHostException uhe) {//thrown when there's no internet connection
                    throw new IOException("unknown host or no network", uhe);
                    //Toast.makeText(getActivity(), uhe.getMessage(), Toast.LENGTH_LONG).show();
                } catch(Exception e) {
                    if (con.getResponseCode() == 429) {
                        throw new ReCaptchaException("reCaptcha Challenge requested");
                    }
                    throw new IOException(e);
                } finally {
                    if(in != null) {
                        in.close();
                    }
                }

                return response.toString();
            }
 

DonManfred

Expert
Licensed User
Longtime User
Where is the code which initialize the CLIENT?
 
Top