title: I receive an error log from my program
body: <p>I am new to android programming.
  In this code I receive an error log and I don't know what to do. I try different things but I still receive the error log. It is something wrong with the input stream, the buffer is not properly created.</p>
  
  <p>Logs :</p>
  
  <pre><code>03-06 21:42:32.897: W/InputEventReceiver(24352): Attempted to finish an input event 
  but the input event receiver has already been disposed.    
  03-06 21:42:32.906: V/FetchWeatherTask(24352): Built URI 
  http://api.openweathermap.org/data/2.5/forecast/daily?q=94043&amp;mode=json&amp;units=metric&amp;cnt=7    
  03-06 21:46:48.231: E/FetchWeatherTask(24352): Error 
  </code></pre>
  
  <p>This is the code :</p>
  
  <pre><code>public class ForecastFragment extends Fragment {
  
  public ForecastFragment() {
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
     forecast
      String[] data = {
              "Mon 6/23 - Sunny - 31/17",
              "Tue 6/24 - Foggy - 21/8",
              "Wed 6/25 - Cloudy - 22/17",
              "Thurs 6/26 - Rainy - 18/11",
              "Fri 6/27 - Foggy - 21/10",
              "Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18",
              "Sun 6/29 - Sunny - 20/7"
      };
      List&lt;String&gt; weekForecast = new ArrayList&lt;String&gt;(Arrays.asList(data));
  
  
      ArrayAdapter&lt;String&gt; forecastAdapter =
              new ArrayAdapter&lt;String&gt;(
                      getActivity(), 
                      R.layout.list_item_forecast, 
                      R.id.list_item_forecast_textview, 
                      weekForecast);
  
      View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  
  
      ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast);
      listView.setAdapter(forecastAdapter);
  
      return rootView;
  }
  
  public class FetchWeatherTask extends AsyncTask&lt;Void, Void, Void&gt; {
  
      private final String LOG_TAG = FetchWeatherTask.class.getSimpleName();
  
      @Override
      protected Void doInBackground(Void... params) {
  
          HttpURLConnection urlConnection = null;
          BufferedReader reader = null;
  
  
          String forecastJsonStr = null;
  
          try {
  
              URL url = new URL("http://api.openweathermap.org/data/2.5/forecast/daily?q=94043&amp;mode=json&amp;units=metric&amp;cnt=7");
  
  
              urlConnection = (HttpURLConnection) url.openConnection();
              urlConnection.setRequestMethod("GET");
              urlConnection.connect();
  
             // I think down in the code is something wrong !!!
              InputStream inputStream = urlConnection.getInputStream();
              StringBuffer buffer = new StringBuffer();
              if (inputStream == null) {
  
                  return null;
              }
              reader = new BufferedReader(new InputStreamReader(inputStream));
  
              String line;
              while ((line = reader.readLine()) != null) {
  
                  buffer.append(line + "\n");
              }
  
              if (buffer.length() == 0) {
  
                  return null;
              }
              forecastJsonStr = buffer.toString();
          } catch (IOException e) {//this is the log that i get
              Log.e(LOG_TAG, "Error ", e);
  
              return null;
          } finally {
              if (urlConnection != null) {
                  urlConnection.disconnect();
              }
              if (reader != null) {
                  try {
                      reader.close();
                  } catch (final IOException e) {
                      Log.e(LOG_TAG, "Error closing stream", e);
                  }
              }
          }
          return null;
      }
  }
  </code></pre>
  
  <p>}</p>