javax.net.ssl.SSLException: Broken pipe error while sending image to server

548 Views Asked by At

i have a update profile activity, and i send the new data to my asp.net server for database updating. when i attempt to upload a new profile image to my server after converting it to base64, i get a error saying javax.net.ssl.SSLException: Write error: ssl=0x795f080788: I/O error during system call, Broken pipe here is my java code below

                    String url;
                    if (imageString==null) {
                        url = String.format("https://**********.com/app/updateprofile.ashx?userid=%s&password=%s&firstname=%s&lastname=%s&phone=%s", intent.getStringExtra("UserID"), intent.getStringExtra("Password"), txtFirstname.getText(), txtLastName.getText(), txtPhone.getText());
                    }
                    else {
                        url = String.format("https://************.com/app/updateprofile.ashx?userid=%s&password=%s&firstname=%s&lastname=%s&phone=%s&pic=%s", intent.getStringExtra("UserID"), intent.getStringExtra("Password"), txtFirstname.getText(), txtLastName.getText(), txtPhone.getText(), imageString);
                    }
                    StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                            new Response.Listener<String>() {
                                @Override
                                public void onResponse(String response) {
                                    try {
                                        JSONObject jsonObject = new JSONObject(response);
                                        String code = jsonObject.getString("code");
                                        if (code.equals("200")) {
                                            Operator.CustomToast(context,getLayoutInflater(),"Profile Updated Successfully!",true,Toast.LENGTH_LONG);
                                            SharedPreferences.Editor editor=sharedPreferences.edit();
                                            editor.putString("FirstName",txtFirstname.getText().toString());
                                            editor.putString("LastName",txtLastName.getText().toString());
                                            editor.putString("Phone",txtPhone.getText().toString());
                                            editor.commit();
                                            accountName.setText(Operator.getCapsSentences(txtFirstname.getText().toString()+" "+txtLastName.getText().toString()));
                                        } else if (code.equals("201")) {
                                            Operator.CustomToast(context,getLayoutInflater(),"Profile Update Failed!",false,Toast.LENGTH_LONG);
                                        } else if (code.equals("202")) {
                                            Operator.CustomToast(context,getLayoutInflater(),"Profile Update Failed!",false,Toast.LENGTH_LONG);
                                        }

                                    } catch (JSONException e) {
                                        e.printStackTrace();
                                        Operator.CustomToast(context,getLayoutInflater(),"Profile Update Failed1!",false,Toast.LENGTH_LONG);
                                    }
                                    updateBtn.setText("Update Profile");
                                    updateBtn.setEnabled(true);
                                    progressBar.setVisibility(View.GONE);
                                }
                            }, new Response.ErrorListener() {
                        @Override
                        public void onErrorResponse(VolleyError error) {
                            Operator.CustomToast(context,getLayoutInflater(),error.getMessage(),false,Toast.LENGTH_LONG);
                            updateBtn.setText("Update Profile");
                            updateBtn.setEnabled(true);
                            progressBar.setVisibility(View.GONE);
                            Log.e("Error1",error.getMessage());
                        }
                    });
                    stringRequest.setShouldCache(false);
                    stringRequest.setRetryPolicy(new DefaultRetryPolicy(
                            500000,
                            0,
                            DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
                    queue.add(stringRequest);```
0

There are 0 best solutions below