pessoal estou com um problema aqui
É uma lista de nota fiscal ou seja qd clico no link da pagina me abre uma lista em excel com varios dados de notas fiscais
se tivesse como debuggar esse codigo ja teria resolvido esse problema, mais como isso estou tratando no proprio servidor não tenho como debbugar
esta dando NullPointerException nesse metodo
[code]public void doProcess(HttpServletRequest request, HttpServletResponse response,
String tipo, int codUnidNegoc, int nf,
int codigoUnidadeNegocio, String dataReferencia, String razaoSocial, int codigoTipoContrato, int codigoContrato)
throws ServletException, IOException, SQLException, Exception {
PrintWriter out = response.getWriter();
String fileName = "NF_" + nf + ".xls";
response.addHeader("Content-Type", "application/vnd.ms-excel");
response.addHeader("Content-disposition", "attachment;filename=" + fileName);
int tipoNota = 0;
String resultado = "";
double valorTotal = 0.0;
int NFe = 0;
boolean bExiste = false;
ArrayList<ExtratoNotaFiscal> extratoNotasFiscais = null;
if (tipo.equalsIgnoreCase("extratoNotaNovo")) {
tipoNota = (new ExtratoNotaFiscal()).getTipoNotaFiscal(codigoUnidadeNegocio, nf);
System.out.println("==================================== valor do tipo de nota : " + tipoNota + " =======================================================");
if (tipoNota == 1 || tipoNota == 2 || tipoNota == 3 || tipoNota == 6) {
extratoNotasFiscais = (new ExtratoNotaFiscal()).getListaExtratoNotaFiscalNovoDefault(codUnidNegoc, nf, tipoNota);
System.out.println("==================================== QUANT. NOTAS FISCAIS = " + extratoNotasFiscais.size() + " =======================================================");
} else if (tipoNota == 4) {
extratoNotasFiscais = (new ExtratoNotaFiscal()).getListaExtratoNotaFiscalNovoTip4(codUnidNegoc, nf, tipoNota);
System.out.println("==================================== executou o tipo 4 =======================================================");
} else if (tipoNota == 5 || tipoNota == 7) {
extratoNotasFiscais = (new ExtratoNotaFiscal()).getListaExtratoNotaFiscalNovoTip5(codUnidNegoc, nf, tipoNota);
System.out.println("==================================== executou o tipo 5 =======================================================");
} else if (tipoNota == 0) {
extratoNotasFiscais = new ArrayList();
}
} else {
extratoNotasFiscais = (new ExtratoNotaFiscal()).getListaExtratoNotaFiscal(codUnidNegoc, nf);
}
if (extratoNotasFiscais != null) {
NFe = extratoNotasFiscais.get(0).getNFe();
} else {
NFe = 0;
}
out.print(" <html> ");
out.print(" <body> ");
out.print(" <table width='100%' border='1' STYLE='border-color:gray;' cellspacing='0' cellpadding='0' CLASS='dez azulEEn'> ");
out.print(" <tr><td colspan='14'> ");
out.print(" <table width='100%' CLASS='dez azulEEn'> ");
out.print(" <tr><td colspan='8'> ");
if (tipoNota == 1 || tipoNota == 2 || tipoNota == 3 || tipoNota == 6) {
out.print(" <h1>BENEFICIÁRIOS COBRADOS NA NOTA</h1> ");
} else if (tipoNota == 4) {
out.print(" <h1>PROFISSIONAIS DE AMBULATÓRIO</h1> ");
} else if (tipoNota == 5 || tipoNota == 7) {
out.print(" <h1>EXTRA CONTRATUAL E MULTA CONTRATUAL</h1> ");
}
out.print(" </td></tr> ");
out.print(" <tr> ");
out.print(" <td style='padding-left:20px;padding-rigth:20px;' colspan='2'>Nota Fiscal: " + NFe + "</td> ");
out.print(" <td style='padding-left:20px;padding-rigth:20px;' colspan='2'>C.I: " + nf + "</td> ");
out.print(" <td style='padding-left:20px;padding-rigth:20px;' colspan='2'>Empresa: " + codigoUnidadeNegocio + "." + codigoTipoContrato + "." + codigoContrato + " - " + razaoSocial + "</td> ");
out.print(" <td style='padding-left:20px;padding-rigth:20px;' colspan='2'>Data de Referência: " + dataReferencia + "</td> ");
out.print(" </tr> ");
out.print(" </table> ");
out.print(" </td></tr> ");
if (tipoNota == 1 || tipoNota == 2 || tipoNota == 3 || tipoNota == 6) {
out.print(" <tr bgcolor='#DDDDDD'> ");
out.print(" <td nowrap>Código do Plano</td> ");
out.print(" <td nowrap>Plano</td> ");
out.print(" <td nowrap>Local</td> ");
out.print(" <td nowrap>Número Amico</td> ");
out.print(" <td nowrap>Depen</td> ");
out.print(" <td nowrap>Beneficiário</td> ");
out.print(" <td nowrap>Idade</td> ");
out.print(" <td nowrap>Seção</td> ");
out.print(" <td nowrap>Registro Funcional</td> ");
out.print(" <td nowrap>Data de Admissão</td> ");
out.print(" <td nowrap>Data de Nascimento</td> ");
out.print(" <td nowrap>Data de Validade</td> ");
out.print(" <td nowrap>Parenteesco</td> ");
out.print(" <td nowrap>Valor</td> ");
out.print(" </tr> ");
} else if (tipoNota == 4) {
out.print(" <tr bgcolor='#DDDDDD'> ");
out.print(" <td nowrap>Nome Ocupação</td> ");
out.print(" <td nowrap>Qtd. Prof. Ambulatório</td> ");
out.print(" <td nowrap>Qtd. Hora Trabalho</td> ");
out.print(" <td nowrap>Valor</td> ");
out.print(" </tr> ");
} else if (tipoNota == 5 || tipoNota == 7) {
out.print(" <tr bgcolor='#DDDDDD'> ");
out.print(" <td nowrap>Número Documento</td> ");
out.print(" <td nowrap>Nome Taxa</td> ");
out.print(" <td nowrap>Valor</td> ");
out.print(" </tr> ");
}
for (ExtratoNotaFiscal extrato : extratoNotasFiscais) {
Beneficiario beneficiario = extrato.getBeneficiario();
System.out.println("ANTES DO IF VALOR É: " + beneficiario.getNumAmico() + " #####################");
if (beneficiario.getNumAmico() != 0) {
System.out.println("ANTES DO IF VALOR É: " + beneficiario.getNumAmico() + " #####################");
bExiste = true;
if (tipoNota == 1 || tipoNota == 2 || tipoNota == 3 || tipoNota == 6) {
out.print(" <tr> ");
if (beneficiario.getCodPlano() != 0) {
out.print(" <td nowrap>" + beneficiario.getCodPlano() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNomePlano() != null) {
out.print(" <td nowrap>" + beneficiario.getNomePlano() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNomeLocal() != null) {
out.print(" <td nowrap>" + beneficiario.getNomeLocal() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNumAmico() != 0) {
out.print(" <td nowrap>" + beneficiario.getNumAmico() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNumDepen() >= 0) {
out.print(" <td nowrap>" + beneficiario.getNumDepen() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNome() != null) {
out.print(" <td nowrap>" + beneficiario.getNome() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getIdade() >= 0) {
out.print(" <td nowrap>" + beneficiario.getIdade() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (extrato.getSecao() != null) {
out.print(" <td nowrap>" + extrato.getSecao() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getNumRegFunc() != 0) {
out.print(" <td nowrap>" + beneficiario.getNumRegFunc() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getDataAdmissao() != null) {
out.print(" <td nowrap>" + beneficiario.getDataAdmissao() + "</td> ");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getDataNascimento() != null) {
out.print(" <td nowrap>" + beneficiario.getDataNascimento() + "</td> ");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getDataValidadeMatricula() != null) {
out.print(" <td nowrap>" + beneficiario.getDataValidadeMatricula() + "</td> ");
} else {
out.print(" <td nowrap> </td>");
}
if (beneficiario.getParentesco() != null) {
out.print(" <td nowrap>" + beneficiario.getParentesco() + "</td> ");
} else {
out.print(" <td nowrap> </td>");
}
if (extrato.getValor() != null) {
out.print(" <td nowrap>" + extrato.getValor() + "</td>");
} else {
out.print(" <td nowrap> </td>");
}
} else if (tipoNota == 4) {
out.print(" <td nowrap>" + extrato.getNomeOcupacao() + "</td>");
out.print(" <td nowrap>" + extrato.getQtdProfAmbulatorio() + "</td>");
out.print(" <td nowrap>" + extrato.getQtdHoraTrabalho() + "</td>");
} else if (tipoNota == 5 || tipoNota == 7) {
out.print(" <td nowrap>" + extrato.getNumeroDocumento() + "</td>");
out.print(" <td nowrap>" + extrato.getNomeTaxa() + "</td>");
}
out.print(" </tr>");
valorTotal += extrato.getValor();
}
}
out.print(" <tr></tr> ");
out.print(" <tr><td colspan='13' align='right'>Total</td><td> " + valorTotal + " </td></tr> ");
out.print(" </table> ");
out.print(" </body> ");
out.print(" </html> ");
out.close();
if (extratoNotasFiscais == null) {
String cliente = "rh";
String site = "";
String msgErro = "Não há Contratos cadastrados no período selecionado.";
msgErro = msgErro.replaceAll(" ", "%20");
response.sendRedirect("/sp/servicos/include_busca_empresas_extratoNotaFiscal.jsp?cliente=" + cliente + "&site=" + site + "&tipo=" + tipo + "&msgErro=" + msgErro);
} /*else {
String fileName = "NF_" + nf + ".xls";
response.setContentType("application/vnd.ms-excel");
//response.addHeader("Content-disposition","attachment;filename=" + fileName);
}*/
}[/code]
se alguem puder me dar uma luz
java.lang.NullPointerException
tv1.dixAmico.SP.notafiscal.ExtratoNota.doProcess(ExtratoNota.java:126)
org.apache.jsp.sp.servicos.resultado_005fextratoNota_jsp._jspService(resultado_005fextratoNota_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)