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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -