503 android studio error

E/Volley: [64021] BasicNetwork.performRequest: Unexpected response code 503 for https://find-ev-charging-stations.glitch.me/trova-colonnine/?latitude=40&longitude=8&minpowerkw=2

Hey @shrijeetshivdekar, I can’t seem to load up your site:

Can you share your (full) logs with us? Possibly even some code?

https://find-ev-charging-stations.glitch.me

use this link!

2021-03-26 19:32:15.339 25278-25278/? E/clientcolonnin: Unknown bits set in runtime_flags: 0x8000
2021-03-26 19:32:16.114 25278-25337/lucagrasso.clientcolonnine E/Perf: Fail to get file list lucagrasso.clientcolonnine
2021-03-26 19:32:16.119 25278-25337/lucagrasso.clientcolonnine E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-03-26 19:32:16.119 25278-25337/lucagrasso.clientcolonnine E/Perf: Fail to get file list lucagrasso.clientcolonnine
2021-03-26 19:32:16.119 25278-25337/lucagrasso.clientcolonnine E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-03-26 19:32:20.552 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:20.552 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:21.134 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:21.134 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:21.810 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:21.814 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:49.314 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:49.314 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:49.330 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:49.345 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:32:54.690 25278-25418/lucagrasso.clientcolonnine E/Volley: [90273] BasicNetwork.performRequest: Unexpected response code 503 for https://find-ev-charging-stations.glitch.me/trova-colonnine/?latitude=21.13878255&longitude=79.05846176&minpowerkw=1
2021-03-26 19:33:10.363 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:10.364 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:10.390 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:10.390 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:10.402 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:10.402 25278-25278/lucagrasso.clientcolonnine E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
2021-03-26 19:33:12.918 25278-25417/lucagrasso.clientcolonnine E/Volley: [90272] BasicNetwork.performRequest: Unexpected response code 503 for https://find-ev-charging-stations.glitch.me/trova-colonnine/?latitude=21.13878255&longitude=79.05846176&minpowerkw=2

503s generally mean there is an error with the server you are “talking” to. Do you make any HTTP requests in your script? To what servers did you make requests too?

package lucagrasso.clientcolonnine;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;
import android.util.Log;

import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.net.Uri;
import android.widget.TextView;

public class ListActivity extends AppCompatActivity {

private ColonninaArrayAdapter arrayAdapter;

private String TAG = "ListActivity";

@Override
protected void onCreate(Bundle savedInstanceState) {

    // create the layout of the activity
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    // I create variables that refer to the elements of the activity: listview and textbox
    final ListView lv = (ListView) findViewById(R.id.lv);
    final TextView errore = (TextView) findViewById(R.id.niente);

    // retrieving data from the calling activity (MainActivity)
    String latitudine = getIntent().getStringExtra("latitudine");
    String longitudine = getIntent().getStringExtra("longitudine");
    String minpowerkw = getIntent().getStringExtra("minpowerkw");
    String mylatitudine = getIntent().getStringExtra("mylatitudine");
    String mylongitudine = getIntent().getStringExtra("mylongitudine");

    // I build the url to make the request
    String url = "https://find-ev-charging-stations.glitch.me/trova-colonnine/?";
    url = url + "latitude=" + latitudine + "&";
    url = url + "longitude=" + longitudine + "&";
    url = url + "minpowerkw=" + minpowerkw;

    // I create the list where the columns found will be inserted
    final ArrayList<Colonnina> colonnine = new ArrayList<Colonnina>();

    // I build the arrayadapter that manages the layout of the column list
    boolean currentPos = latitudine.equals(mylatitudine) && longitudine.equals(mylongitudine);
    arrayAdapter = new ColonninaArrayAdapter(this, 0, colonnine, currentPos);

    // I connect the arrayadapter to the listview
    lv.setAdapter(arrayAdapter);

    // I create the request to the service that looks for the columns
    JsonArrayRequest jsonObjectRequest = new JsonArrayRequest
            (Request.Method.GET, url, null, new Response.Listener<JSONArray>() {

                @Override
                public void onResponse(JSONArray response) {
                    try {
                        // I transform the answer into an array of Column objects
                        parseColonnine(colonnine, response);


                       // I notify the adapter to update the activity
                        arrayAdapter.notifyDataSetChanged();


                        // if the list of columns found is empty or an error occurs,
                        // I write a warning message
                        if(colonnine.isEmpty())
                            errore.setText("No columns found.\n");
                    } catch(Exception ex) {
                        errore.setText("No columns found.\n.");
                    }
                }
            }, new Response.ErrorListener() {

                @Override
                public void onErrorResponse(VolleyError error) {
                    errore.setText("No columns found.\n");

                }
            });

    // I add the request to the app queue
    MyApplication.getInstance().addToRequestQueue(jsonObjectRequest, MyApplication.TAG);


}

//
//method that transforms the response of the post finder service into a Post List
private void parseColonnine(ArrayList<Colonnina> colonnine, JSONArray arrayColonnine) throws JSONException {

    JSONObject colObject = null;
    for(int i=0; i<arrayColonnine.length(); i++){
        colObject = arrayColonnine.getJSONObject(i);
        Colonnina col = new Colonnina();

        col.setDistanza(colObject.get("distance").toString());
        col.setLatitudine(colObject.get("Latitude").toString());
        col.setLongitudine(colObject.get("Longitude").toString());
        col.setId(colObject.get("id").toString());

        colonnine.add(col);
    }

}

// class that creates for each column its graphic element to be inserted on the page
class ColonninaArrayAdapter extends ArrayAdapter {

    private Context context;
    private List<Colonnina> colonnine;
    private Colonnina col;
    private boolean currentPos;

    public ColonninaArrayAdapter(Context context, int resource, ArrayList<Colonnina> objects, boolean currentPos) {
        super(context, resource, objects);

        this.context = context;
        this.colonnine = objects;
        this.currentPos = currentPos;
    }

    // creation of the graphic element that contains the data of a column
    // this method is called for each column found
    public View getView(int position, View convertView, ViewGroup parent) {

        // retrieving the column to be displayed from the list
        col = colonnine.get(position);

        // I create the layout
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.list_colonnina_item, null);

        // I create variables that refer to graphic elements: text areas and buttons
        TextView id_colonnina = (TextView) view.findViewById(R.id.id_colonnina);
        TextView coordinate = (TextView) view.findViewById(R.id.coordinate);

        Button inviaCommento = view.findViewById(R.id.commento);
        Button apriMappa = view.findViewById(R.id.apri_mappa);

        // I update the text of the text areas that contain the column id and the coordinates
        id_colonnina.setText("ID: " + col.getId());
        coordinate.setText("Coordinate: " + col.getLatitudine() + ", " + col.getLongitudine());

        // I connect an onclicklistener to the SEND COMMENT button
        inviaCommento.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getBaseContext(), AddCommentActivity.class);
                intent.putExtra("id", col.getId() + "");
                startActivity(intent);
            }
        });

        // I connect an onclicklistener to the GO TO MAP button
        apriMappa.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri gmmIntentUri = Uri.parse("google.navigation:q=" + col.getLatitudine()+","+col.getLongitudine());
                
                Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
                mapIntent.setPackage("com.google.android.apps.maps");
                startActivity(mapIntent);
            }
        });

        return view;
    }
}

}

It seems that requesting this url gives you a 503 error:

image

Can you check the logs in this project?

2 Likes

the server is the problem, the author said that he needs to find another server with node.js.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.