Commit 432541e7 authored by ssalve's avatar ssalve

Sarita: Done changes to resolve nullPointerException for refDate , effDate on...

Sarita: Done changes to resolve nullPointerException for refDate , effDate on 13 JUN 18 for getData and process

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186429 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a7eacd68
......@@ -58,7 +58,7 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
System.out.println("XML String :" + xmlString2);
dom1 = genericUtility.parseString(xmlString2);
}
rtrStr = getData(dom, dom1, windowName, xtraParams);
rtrStr = getData(dom, dom1, windowName, xtraParams); System.out.println("rtrStr ["+rtrStr+"]");
} catch (Exception e) {
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"
+ e.getMessage() + ":");
......@@ -96,6 +96,10 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
// GenericUtility genericUtility = GenericUtility.getInstance();
E12GenericUtility genericUtility = new E12GenericUtility();
SimpleDateFormat sdf = null;
//Added by sarita on 13 JUN 18 to NULL check refDate or tranDate[start]
java.sql.Timestamp refDate1 = null , tranDate = null;
String refDateStr = "" , tranDateStr = "";
//Added by sarita on 13 JUN 18 to NULL check refDate or tranDate[end]
try {
//Changes and Commented By Bhushan on 06-06-2016 :START
//conn = connDriver.getConnectDB("DriverITM");
......@@ -175,10 +179,25 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
if (entryBatchNo == null) {
entryBatchNo = " ";
}
//Added by sarita on 13 JUN 18 to NULL check refDate or tranDate [START]
refDate1 = rs.getTimestamp("REF_DATE");
tranDate = rs.getTimestamp("TRAN_DATE");
if(refDate1 != null)
{
refDateStr = sdf.format(refDate1);System.out.println("REF_DATE is ["+refDate1+"] \t refDateStr is ["+refDateStr+"]");
}
if(tranDate != null)
{
tranDateStr = sdf.format(tranDate);System.out.println("TRAN_DATE is ["+tranDate+"] \t tranDateStr is ["+tranDateStr+"]");
}
//Added by sarita on 13 JUN 18 to NULL check refDate or tranDate [END]
retTabSepStrBuff.append("<Detail2>");
retTabSepStrBuff.append("<entry_batch_no>").append("<![CDATA[" + entryBatchNo + "]]>").append("</entry_batch_no>");
retTabSepStrBuff.append("<ref_no>").append("<![CDATA[" + checkNull(rs.getString("REF_NO")) + "]]>").append("</ref_no>");
retTabSepStrBuff.append("<ref_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("REF_DATE"))+ "]]>").append("</ref_date>");
//retTabSepStrBuff.append("<ref_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("REF_DATE"))+ "]]>").append("</ref_date>");
retTabSepStrBuff.append("<ref_date>").append("<![CDATA["+ refDateStr + "]]>").append("</ref_date>");
retTabSepStrBuff.append("<amount>").append("<![CDATA[" + checkNull(rs.getString("AMOUNT")) + "]]>").append("</amount>");
retTabSepStrBuff.append("<curr_code>").append("<![CDATA[" + checkNull(rs.getString("CURR_CODE")) + "]]>").append("</curr_code>");
retTabSepStrBuff.append("<amount_curr>").append("<![CDATA[" + rs.getDouble("AMOUNT") / rs.getDouble("EXCH_RATE") + "]]>").append("</amount_curr>");
......@@ -186,7 +205,8 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
retTabSepStrBuff.append("<sundry_code>").append("<![CDATA[" + checkNull(rs.getString("SUNDRY_CODE")) + "]]>").append("</sundry_code>");
retTabSepStrBuff.append("<sundry_name>").append("<![CDATA[" + checkNull(rs.getString("SUNDRY_NAME")) + "]]>").append("</sundry_name>");
retTabSepStrBuff.append("<amt_adj>").append("<![CDATA[" + checkNull(rs.getString("AMT_ADJ")) + "]]>").append("</amt_adj>");
retTabSepStrBuff.append("<tran_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("TRAN_DATE")) + "]]>").append("</tran_date>");
//retTabSepStrBuff.append("<tran_date>").append("<![CDATA["+ sdf.format(rs.getTimestamp("TRAN_DATE")) + "]]>").append("</tran_date>");
retTabSepStrBuff.append("<tran_date>").append("<![CDATA["+ tranDateStr + "]]>").append("</tran_date>");
retTabSepStrBuff.append("<ref_mode>").append("<![CDATA[" + checkNull(rs.getString("REF_MODE")) + "]]>").append("</ref_mode>");
retTabSepStrBuff.append("<tran_ser>").append("<![CDATA[" + checkNull(rs.getString("TRAN_SER")) + "]]>").append("</tran_ser>");
retTabSepStrBuff.append("<tran_no>").append("<![CDATA[" + checkNull(rs.getString("TRAN_NO")) + "]]>").append("</tran_no>");
......@@ -254,6 +274,7 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
headerDom = genericUtility.parseString(xmlString);
}
retStr = process(headerDom, detailDom, windowName, xtraParams);
System.out.println("return String [Process] :" +retStr);
} catch (Exception e) {
System.out.println("Exception :BankRecoEJB :getData(String xmlString, String xmlString2, String windowName, String xtraParams):"+ e.getMessage() + ":");
throw new ITMException(e);
......@@ -304,6 +325,7 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
//Changes and Commented By Bhushan on 06-06-2016 :END
parentNodeList = detailDom.getElementsByTagName("Detail2");
parentNodeListLength = parentNodeList.getLength();
System.out.println("parentNodeList : ["+parentNodeList+"]");
sql = "SELECT AMOUNT, AMT_ADJ, STATUS, EXCH_RATE FROM BANKTRAN_LOG WHERE TRAN_ID = ? ";// '"+tranId+"'";
pstmt = conn.prepareStatement(sql);
for (int header = 0; header < parentNodeListLength; header++) {
......@@ -463,7 +485,9 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
String updateSql = "";
int insertCnt = 0;
int updateCnt = 0;
//Added by sarita on 13 JUN 18 to NULL check refDate or effDate [START]
java.sql.Date effDate1 = null , refDate2 = null;
//Added by sarita on 13 JUN 18 to NULL check refDate or effDate [END]
//java.sql.Timestamp refDateTs = null, effDateTs = null;
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
......@@ -725,12 +749,26 @@ public class BankRecoPrc extends ProcessEJB implements BankRecoPrcLocal,
System.out.println("Amount@@@@@@@@@@@@" + amt);
amt3 = Double.valueOf(amtAdj);
System.out.println("Adj Amount@@@@@@@@@@@@" + amt3);
java.sql.Date effDate1 = java.sql.Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
//Added and Commented by sarita on 13 JUN 18 to NULL check effDate[START]
/*java.sql.Date effDate1 = java.sql.Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
System.out.println("effDate1 :" + effDate1);*/
if(effDate != null && effDate.trim().length() > 0)
{
effDate1 = java.sql.Date.valueOf(genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
}
System.out.println("effDate1 :" + effDate1);
//Added and Commented by sarita on 13 JUN 18 to NULL check effDate[END]
System.out.println("refDate :" + new java.sql.Date(System.currentTimeMillis()));
// String refDate1 = refDate.substring(0,10);
java.sql.Date refDate2 = java.sql.Date.valueOf(genericUtility.getValidDateString(refDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
//Added and Commented by sarita on 13 JUN 18 to NULL check refDate [START]
//java.sql.Date refDate2 = java.sql.Date.valueOf(genericUtility.getValidDateString(refDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
//System.out.println("refDate2 :" + refDate2);
if(refDate != null && refDate.trim().length() > 0)
{
refDate2 = java.sql.Date.valueOf(genericUtility.getValidDateString(refDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()));
}
System.out.println("refDate2 :" + refDate2);
//Added and Commented by sarita on 13 JUN 18 to NULL check refDate[END]
insertSql = "INSERT INTO BANK_STATEMENT(TRAN_ID, BANK_CODE, SITE_CODE, REF_NO, REF_DATE,"
+ " REF_MODE, AMOUNT, TRAN_TYPE, EDI_REF, REMARKS, STATUS, CHG_DATE, CHG_USER, CHG_TERM,"
+ " AMT_ADJ, EFF_DATE, AUTO_ENTRY, STATUS_DATE, EXCH_RATE, CURR_CODE , STAT_DATE)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment