title: BufferedReader Nullpointer Exception on web txt
body: <p>I tried to do a simple class that reads out the contents of a online .txt and stores it in a DataClass.</p>
  
  <p>Somehow I get an Nullpointer exception in the first variable assign in the while loop, although line is printed out as being "4". </p>
  
  <p>Anyone know the Problem in my code?</p>
  
  <pre><code>public class GetFile {
  public static List&lt;Log&gt; getFile(){
      URL url = null;
      List&lt;Log&gt; list = new ArrayList&lt;Log&gt;();
  
      try {
          url = new URL("http://test.net/test.txt");
          BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
          String line;
          while ((line = in.readLine()) != null) {
                  Log log = new Log();
                  System.out.println("Line is: " + line);
  
                  **--&gt;log.day = Integer.getInteger(line);&lt;--**
  
                  line = in.readLine();
                  log.month = Integer.getInteger(line);
                  line = in.readLine();
                  log.year = Integer.getInteger(line);
                  line = in.readLine();
                  log.hour = Integer.getInteger(line);
                  line = in.readLine();
                  log.minute = Integer.getInteger(line);
                  line = in.readLine();
                  log.hum = Float.parseFloat(line);
                  line = in.readLine();
                  log.temp = Float.parseFloat(line);
                  list.add(log);
                  System.out.println("Item added");
          }
          in.close();
  
  
      } catch (MalformedURLException e) {
          e.printStackTrace();
      }
      catch (IOException e1) {
          e1.printStackTrace();
      }
  
  
  
      return list;
  }
  }
  </code></pre>
  
  <p>Content of the .txt is following:</p>
  
  <pre><code>4
  2
  2016
  22
  14
  49.5999984741
  19.2999992371
  4
  2
  2016
  22
  14
  49.5999984741
  19.2999992371
  4
  2
  2016
  ...
  </code></pre>