title: Showing java.lang.NullPointerException at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:150) in Testng
body: <p>It is showing me error while I am using CSVReader</p>
  
  <pre><code>public class firstclass {
      private static WebDriver driver= new FirefoxDriver();
  
      @DataProvider(name="readcredentials")
      public Object[][] readcredentials() throws Exception{
  
          CSVReader readunamepass= new CSVReader(new FileReader("D:/My Projects  New/BSP/Aut/Credentials.csv"));
          List&lt;String[]&gt; list = readunamepass.readAll();  
          Iterator&lt;String[]&gt; readnext = list.iterator();
  
          while(readnext.hasNext())
          {
  
              String[] credential = readnext.next();
              System.out.println("" +readnext);
              System.out.println("username"+credential[0]+"password" +credential[1]);
              f(credential[0], credential[1]);
  
           }
          return null;
      }
  
      @Test(priority=1, dataProvider="readcredentials")
      public void f(String credential, String credential2) throws Exception {
          getDriver().get("http://192.168.1.111/lms");
          getDriver().findElement(By.id("txtUserId")).sendKeys( credential);
          getDriver().findElement(By.id("txtPwd")).sendKeys(credential2);
          getDriver().findElement(By.id("btnSign")).click();
          //Thread.sleep(100000);
          //System.out.println("This is method");
      }
  
      public WebDriver getDriver(){
  
          return driver;
  
      }
  </code></pre>
  
  <p>In this program, @dataprovider is reading uname and password from a csv file and passing it to Test method.
  I am not able to provide return type so that I have provided null.Please help
  More detail -
  I have tried to return object but it is showing me some suggestions. I have tried but showing error in compilation. See image <a href="http://i.stack.imgur.com/H64Ys.png" rel="nofollow">Error image</a></p>
  
  <p><a href="http://i.stack.imgur.com/K00KY.png" rel="nofollow">Stacktrace</a></p>