Hi there,
I'm having more problems trying to make Clover print orders, following on from https://devask.clover.com/question/31...
My code is starting a new print job, which causes an NPE on the print thread which is not part of my app (com.clover.engine.services
). This means that I cannot catch the exception. When the NullPointerException occurs the Clover Mini device will play the error noise over and over until someone manually clears the print queue (!). I can't ship app where trying to print an order causes the POS to malfunction like this, so I'd really appreciate any help debugging this.
The NPE has the following stack trace:
08-10 16:02:55.065 1727-23209/? W/SeikoMini: onHandleIntent(PrinterIntentService.java:391): print failed, printer: Printer{uuid=AHPNN7RZVWDVP, type=SEIKO_MINI_USB, name=Mini, mac=null, ip=null, category=RECEIPT}
java.lang.NullPointerException
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:1711)
at com.clover.engine.services.ReceiptPrinterPlugins.ReceiptGenerator.createReceiptView(ReceiptGenerator.java:1576)
at com.clover.engine.services.ReceiptPrinterPlugins.seiko.SeikoMini.printReceipt(SeikoMini.java:75)
at com.clover.engine.services.PrinterIntentService.onHandleIntent(PrinterIntentService.java:320)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
My (Kotlin) code is here: https://gist.github.com/marcomorain/f...
The problematic line is:
StaticBillPrintJob.Builder().order(o).build().print(context, account, printer)
This causes the NPE in the other activity.
Can you share the source of ReceiptGenerator.java or otherwise help me understand how avoid the NPE on line 391?
The order is created by our backend-server, and the order definitely exists before we ask the device to print it. We create the order, after which we send a notification to the device using the notifications API.
Thanks,
Marc