-
While executing below code i'm getting NullpointerException.
public class SftpConn { public List<String> searchableFields(String sheetName, int column) { if (sheet == null) { sftpConnect(); } List<String> test=null; sheet = wb.getSheet(sheetName); int rowcount = sheet.getLastRowNum(); for (int i = 1; i <= rowcount; i++) { Row r = CellUtil.getRow(i, sheet); key = CellUtil.getCell(r, column).getStringCellValue(); System.out.println("key = "+key); test.add(key); } return test; } }
2.Below is the main class where i'm calling "searchableFields" from searchableFields
3.every time i'm seeing same error please suggest"
public class MyTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
SftpConn sftp = new SftpConn();
List<String> list = sftp.searchableFields("Searchable Fields", 0);
System.out.println(list);
}
}
Below is my Out put please suggest that what could be the issue.
Session connected true key = Check Document Exception in thread "main" java.lang.NullPointerException at com.brcc.tool.Configuration.SftpConn.searchableFields(SftpConn.java:120) at com.brcc.tool.Configuration.MyTest.main(MyTest.java:10) *