title: Java IBM Lotus Notes retrive data from view fails in the middle due to null object
body: <p>I am trying to retrieve data from lotus notes database view using a java program. Below is my code: </p>
  
  <pre><code>int resultsCount = view.getEntryCount();
  print("Results found in view = " + resultsCount);           
  
  Document doc = view.getFirstDocument();
  if (doc != null) {
      int count = 1;  
      while (count &lt;= resultsCount) {
          count++;
          try {
              doc = view.getNextDocument(doc);
              if (doc == null) {
                  print("Record " + count + " error. Null object.");  
              } 
          } catch (NotesException e) {
                  print("Record " + count + " error. Exception.");
          }
      }
  }
  else {
      print("Record " + count + " error. Null object.");
  }
  </code></pre>
  
  <p>I get below results:<br>
  <em>Results found in view = 1567<br>
  Record 866 error. Null object.</em></p>
  
  <p>Why is there a null document found when actually 1567 records present in the db view?<br>
  How can I resume to get rest of the records, because view.getNextDocument(doc) fails with Notes Exception after this happens.</p>