NullPointerException
<p>I am facing some problem in this function where I'm running into null values and getting a null pointer exception. <code>sqlDate</code> and <code>sqlTime</code> are null.</p>

<pre><code> private void setCalendarComboDetails(Map tenantConnInfo, HttpSession session, HttpServletRequest request) {
    logger.info("Enter setCalendarComboDetails");
    Appointment appointmentInfo = new Appointment();
    Date sqlDate;
    Time sqlTime;

    try {
        CompanyDbImpl companyImpl = new CompanyDbImpl(tenantConnInfo);
        PatientDbImpl patientImpl = new PatientDbImpl(tenantConnInfo);
        DoctorDbImpl doctorImpl = new DoctorDbImpl(tenantConnInfo);

        CalendarDbImpl calendarImpl = new CalendarDbImpl(tenantConnInfo);
        ConfigurationDbImpl configurationImpl = new ConfigurationDbImpl(tenantConnInfo);
        session.setAttribute("isvalid",true);
        session.removeAttribute("appointmentInfo");
       // session.removeAttribute("index");
        List&lt;CompanyBranchDetails&gt; branchDetailsList = companyImpl.getCompanyNBranchList();
        session.setAttribute("companyBranchList", branchDetailsList);

        List&lt;PatientInfo&gt; patientList = patientImpl.getPatientInfoList();
        session.setAttribute("patientInfoList", patientList);

        String whereClause = " dbd.branch_id=" + branchDetailsList.get(0).getBranchId();

        List&lt;DoctorBranchDetails&gt; doctorBranchDetailsList = doctorImpl.getDoctorBranchDetailsListByWhereClause(whereClause);
        System.out.println("doctor branch list size " + doctorBranchDetailsList.size());
        session.setAttribute("doctorBranchList", doctorBranchDetailsList);

        Map configMap = configurationImpl.getConfigurationMapByConfigType(ApplicationConstants.CONFIGURATION_TYPE_CALENDAR);

        int timeFormatId = Integer.parseInt(configMap.get("time_format_id").toString());
        whereClause = " time_format_id=" + timeFormatId;
        String dbTimeFormat = calendarImpl.getTimeFormatListByWhereClause(whereClause).get(0).getTimeFormatType();

        int dateFormatId = Integer.parseInt(configMap.get("date_format_id").toString());
        whereClause = " date_format_id=" + dateFormatId;
        String dbDateFormat = calendarImpl.getDateFormatListByWhereClause(whereClause).get(0).getDateFormatType();
        session.setAttribute("calendarDateFormat", dbDateFormat);

        String jsStart = request.getParameter("start1");
        String jsEnd = request.getParameter("end1");
        String jsDateNTimeFormat = ApplicationConstants.JS_DATENTIME_PATTERN;
        System.out.println("start1 " + request.getParameter("start1") + " " + new java.util.Date());

        sqlDate = appointmentInfo.getStartDate().getDatepickerDate();
            appointmentInfo.setStrStartDate(ApplicationUtils.formatSqlDate(dbDateFormat, sqlDate));
        System.out.println("sqlDate1"+sqlDate);
          sqlTime = appointmentInfo.getStartTime().getTimepickerTime();
            appointmentInfo.setStrStartTime(ApplicationUtils.formatSqlTime(dbTimeFormat, sqlTime));
            java.util.Date date1 = ApplicationUtils.getDateFromSqlDateNTime(sqlDate, sqlTime);

            sqlDate = appointmentInfo.getEndDate().getDatepickerDate();
            appointmentInfo.setStrEndDate(ApplicationUtils.formatSqlDate(dbDateFormat, sqlDate));

            sqlTime = appointmentInfo.getEndTime().getTimepickerTime();
            appointmentInfo.setStrEndTime(ApplicationUtils.formatSqlTime(dbTimeFormat, sqlTime));

            java.util.Date date2 = ApplicationUtils.getDateFromSqlDateNTime(sqlDate, sqlTime);

            String diff = ApplicationUtils.getDateDifference(date1, date2);
            appointmentInfo.setDuration(diff);
            System.out.println("difference"+diff);
        if(session.getAttribute("index") != null) {
             doctorBranchDetailsList = (ArrayList&lt;DoctorBranchDetails&gt;)session.getAttribute("doctorBranchDetailsList");
            int selectedIndex = Integer.parseInt(session.getAttribute("index").toString());
        DoctorBranchDetails doctorBranchInfo = doctorBranchDetailsList.get(selectedIndex);           
        appointmentInfo.getDoctorBranchDetails().setDoctorBranchId(doctorBranchInfo.getDoctorBranchId());
        appointmentInfo.getDoctorBranchDetails().getCompanyBranchDetails().setBranchId(doctorBranchInfo.getCompanyBranchDetails().getBranchId());
        appointmentInfo.getDoctorBranchDetails().setDoctorName(doctorBranchInfo.getDoctorInfo().getFullName());
         appointmentInfo.getDoctorBranchDetails().setBranchNType(doctorBranchInfo.getBranchNType());           
        }

             appointmentInfo.setStrStartDate(ApplicationUtils.converDateFormats(jsStart, jsDateNTimeFormat, dbDateFormat));
        appointmentInfo.setStrStartTime(ApplicationUtils.converDateFormats(jsStart, jsDateNTimeFormat, dbTimeFormat));
        appointmentInfo.setStrEndDate(ApplicationUtils.converDateFormats(jsEnd, jsDateNTimeFormat, dbDateFormat));
        appointmentInfo.setStrEndTime(ApplicationUtils.converDateFormats(jsEnd, jsDateNTimeFormat, dbTimeFormat));

        session.setAttribute("appointmentInfo", appointmentInfo);
    } catch (Exception e) {
        logger.error(e, e);
    }
    logger.info("Exit setCalendarComboDetails");
}
</code></pre>
