ERROR Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

0

I try to create PDF using a comma delimited txt file, but when I create the PDF it sends an error:

  

JRCsvDataSource ds = new   JRCsvDataSource (JRLoader.getLocationInputStream (RutaTXT))

This is the class to create PDF using JASPER to create a cover, and the txt will fill that report.

public class PDF {
    private JasperPrint jasperPrint;

    public void CrearReportPDF(String RutaPDF, String RutaTXT) throws JRException {
        jasperPrint = JasperFillManager.fillReport(".\Recursos\NUMERO_ORDEN.jasper", null, getDataSource(RutaTXT));
        JasperExportManager.exportReportToPdfFile(jasperPrint, RutaPDF);
    }

    private JRCsvDataSource getDataSource(String RutaTXT) throws JRException {
        JRCsvDataSource ds = new JRCsvDataSource(JRLoader.getLocationInputStream(RutaTXT));
        ds.setRecordDelimiter("\n");
        ds.setFieldDelimiter('#');
        ds.setUseFirstRowAsHeader(true);
        return ds;
    }
}  
    
asked by Summer 11.09.2018 в 19:39
source

0 answers