public JasperPrint printReport(String path, Treport report, List subList,
Map parameters, List data) throws JRRuntimeException {
//主报表模板
JasperReport jasperReport = null;
String templateName = path + "\\rpt\\" + report.getTemplate() + ".jasper";
File reportFile = new File(templateName);
if (!reportFile.exists())
throw new JRRuntimeException("报表模板文件<"+report.getTemplate()+">不存在或是未编译!!!");
try {
jasperReport = (JasperReport) JRLoader.loadObject(templateName);
} catch (JRException e) {
throw new JRRuntimeException("导入模板文件<"+report.getTemplate()+">失败!!!");
}
//获取子报表
String subTemplateName;
File subReportFile;
JasperReport subJasperReport;
for(int i=0;i<subList.size();i++){
TsubReport tsubReport = (TsubReport)subList.get(i);
subTemplateName = path + "\\rpt\\" + tsubReport.getTemplate() + ".jasper";
subReportFile = new File(subTemplateName);
if (!subReportFile.exists())
throw new JRRuntimeException("子报表模板文件<"+report.getTemplate()+">不存在或是未编译!!!");
try {
subJasperReport = (JasperReport) JRLoader.loadObject(subTemplateName);
} catch (JRException e) {
throw new JRRuntimeException("导入子模板文件<"+report.getTemplate()+">失败!!!");
}
parameters.put(tsubReport.getParamvalue(),subJasperReport);
}

JasperPrint jasperPrint;
Connection conn = null;
ReportList reportList = new ReportList();
reportList.setReportData(data);
try{
try {
conn = dataSource.getConnection();
} catch (SQLException e2) {
e2.printStackTrace();
}  
parameters.put(JRParameter.REPORT_CONNECTION,conn);
try {
jasperPrint=JasperFillManager.fillReport(jasperReport,parameters,reportList);
} catch (JRException e1) {
throw new JRRuntimeException("生成报表数据时出现错误:" + e1.toString());
}
try {
conn.close();
} catch (SQLException e3) {
e3.printStackTrace();
}
}
finally{
conn = null;
templateName = null;
jasperReport = null;
reportFile = null;
subTemplateName = null;
subReportFile = null;
subJasperReport = null;
}

return jasperPrint;
}
运行到红色那行代码时出现空指针错误,请问该如何解决