When i am executing this code, i am getting null pointer Exception.pls help me to fix the problem.
Here is the code:
try{
int rows1=CustomerPaymentRow_Table.getRowCount();
for(int i=0;i<rows1;i++){
Object value=CustomerPaymentRow_Table.getModel().getValue At(i, 11);
String state=value.toString();
System.out.println(state);
if(state=="true")
{
//
Object value0=CustomerPaymentRow_Table.getModel().getValu eAt(i,0);
InvoiceNo =value0.toString();
//
Object value1=CustomerPaymentRow_Table.getModel().getValu eAt(i,1);
InvoiceDate = value1.toString();
//
Object value2=CustomerPaymentRow_Table.getModel().getValu eAt(i,2);
AmountDue=value2.toString();
//
Object value3=CustomerPaymentRow_Table.getModel().getValu eAt(i,3);
Discount=value3.toString();
//
Object value10=CustomerPaymentRow_Table.getModel().getVal ueAt(i,4);
NetAmt=value10.toString();
//
Object value4=CustomerPaymentRow_Table.getModel().getValu eAt(i,5);
NetPay=value4.toString();
//
Object value5=CustomerPaymentRow_Table.getModel().getValu eAt(i,6);
RowBalance=value5.toString();
double Row_Baldouble = Double.parseDouble(RowBalance);
//
Object value6=CustomerPaymentRow_Table.getModel().getValu eAt(i,7);
Paymentmode=value6.toString();
//
Object value7=CustomerPaymentRow_Table.getModel().getValu eAt(i,8);
ChqNo=value7.toString();
//
Object value8=CustomerPaymentRow_Table.getModel().getValu eAt(i,9);
ChqDate=value8.toString();
//
Object value9=CustomerPaymentRow_Table.getModel().getValu eAt(i,10);
Bank=value9.toString();
//
docentry=DocEntry_FTextField.getText();
//Inserting data into Receipt_hdr and Receipt_row
String sql1=("insert into receipt_row(DocEntry,ReceiptNo,InvoiceNo,InvoiceDa te,AmountDue,DiscountPerc,RowBalance,NetAmount,Pay Mode,NetPay,ChqNo,ChqDate,Bank) values('"+docentry+"','"+docentry+"','"+InvoiceNo+ "','"+InvoiceDate+"','"+AmountDue+"','"+Discount+" ','"+RowBalance+"','"+NetAmt+"','"+Paymentmode+"', '"+NetPay+"','"+ChqNo+"','"+ChqDate+"','"+Bank+"') ");
n=st.executeUpdate(sql1);
}
}----------------
//Checking that receipt_row,customercode,customername,compname for null values
if((n != 0)&&(cus_id.length()!=0)&&(cus_name.length()!=0)&& (comp_name.length()!=0))
{
System.out.println("condition checked");
String sql=("insert into receipt_hdr(DocEntry,DocDate,DocStatus,CardCode,Ca rdName,SMCode,Remarks,DocTotal,DiscountPerc,NetTot al,BaseRef,BeatCode,CompCode) values('"+docentry+"','"+docdate+"','"+DocStatus+" ','"+cus_id+"','"+cus_name+"','"+comp_name+"','"+r emarks+"','"+doc_total+"','"+discount_hdr+"','"+ne t_total+"','"+base_ref+"','"+beatcode+"','"+comp_n ame+"')");
System.out.println("insert");
m=st.executeUpdate(sql);
System.out.println("hdr inserted");
JOptionPane.showMessageDialog(null,"Payment Done!");
}
else{
JOptionPane.showMessageDialog(null,"Provide Mandatory Informations");
}
}
catch(Exception e) {
System.out.println(e);
}
In this code,code is successfully executing till that dotted line.After that only code is not executing.why?
pls help me...