java - null point exception if not having value in array -


client:

for(int j=0;j<prod10.length;j++){             string ret_val ="";             bean.setprod10(prod10[j]);             ret_val=build.saversupplier(bean);          } 

dao:

if(rs.next()){                 string sum=rs.getstring("max(patient_no)+1");                 string q7="insert new8(ok, reference)"                         + " values('"+sum+"','"+purid10+"')";                 preparedstatement p7 = con.preparestatement(q7);                 int s7 = p7.executeupdate();                     } 

if put value in array using prod10 set length , array of data stored in database if not put value in array null point exception occur,this should not have happen should have this

i presume prod10 array null. have null check before loop.

if(null != prod10) { for(int j=0;j<prod10.length;j++){             string ret_val ="";             bean.setprod10(prod10[j]);             ret_val=build.saversupplier(bean);          } } 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -