简体   繁体   中英

Why does j8583 Configparser fails with no default value to template fields?

I am using j8583 to build and parse ISO messages. I have my template and parse config.xml in place, but when there are no default values specified to template fields it fails with NullPointerException .

Below is the template which fails with NullPointerException .

Field 3 doesn't have any default value.

<template type="0200">
<field num="3" type="NUMERIC" length="6"></field>
<field num="32" type="LLVAR">456</field>
<field num="35" type="LLVAR">4591700012340000=</field>
<field num="43" type="ALPHA" length="40">SOLABTEST             TEST-3       DF MX</field>
<field num="49" type="ALPHA" length="3">484</field>
<field num="60" type="LLLVAR">B456PRO1+000</field>
<field num="61" type="LLLVAR">        1234P</field>
<field num="100" type="LLVAR">999</field>
<field num="102" type="LLVAR">ABCD</field>

Well you're specifying field 3 to be a NUMERIC field of 6 digits and you didn't set any value. It's weird that you get NPE, should be NumberFormatException when it tries to parse the empty string.

Please file an issue on github.com/chochos/j8583 and I'll look into it (I'm the author of j8583).

In the meantime, try setting the value to 0. Or, if you don't need the field, just omit it from the template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM