错误打包字段61(org.jpos.iso.ISOException:java.lang.NullPointerException(java.lang.NullPointerException))

时间:2018-02-20 11:25:21

标签: java packaging iso8583 jpos mastercard

我正在使用万事达卡接口规范打包字段61,如下所示:

<isofieldpackager
    id="61"
    length="40"
    name="Point-of-Service (POS) Data"
    class="org.jpos.iso.IFB_LLBINARY"
    emitBitmap="false"
    packager="org.jpos.iso.packager.GenericSubFieldPackager">
    <isofield
        id="1"
        length="1"
        name="POS Terminal Attendance"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="3"
        length="1"
        name="POS Terminal Location"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="4"
        length="1"
        name="POS Cardholder Presence"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="5"
        length="1"
        name="POS Card Presence"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="6"
        length="1"
        name="POS Card Capture Capabilities"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="7"
        length="1"
        name="POS Transaction Status"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="8"
        length="1"
        name="POS Transaction Security"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="10"
        length="1"
        name="Cardholder-Activated Terminal Level"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="11"
        length="1"
        name="POS Card Data Terminal Input Capability Indicator"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="12"
        length="2"
        name="POS Card Data Terminal Input Capability Indicator"
        class="org.jpos.iso.IF_CHAR"/>
    <isofield
        id="13"
        length="3"
        name="POS Country Code"
        class="org.jpos.iso.IF_CHAR"/>
</isofieldpackager>

然后我像这样打电话给打包者:

ISOMsg message = new ISOMsg();
message.set("61.1", "1");       //Unattended terminal
    message.set("61.3", "2");       //Off premises of card acceptor facility
    message.set("61.4", "5");       //Electronic order (home PC, Internet, mobile phone, PDA)
    message.set("61.5", "1");       //Card not present
    message.set("61.6", "0");       //Terminal/operator has no card capture capability
    message.set("61.7", "0");       //Normal request (original presentment)
    message.set("61.8", "0");       //No security concern
    message.set("61.10", "6");      //Authorized Level 6 CAT: Electronic commerce
    message.set("61.11", "6");      //Key entry only
    message.set("61.12", "00");
    message.set("61.13", "716");    //country code Zimbabwe

但后来我得到一个看起来像这样的例外:

    <log realm="channel/127.0.0.1:1234" at="2018-02-20T13:02:14.775" lifespan="31ms">
  <connect>
Exception in thread "main" org.jpos.iso.ISOException: error packing field 61 (org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException))
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:184)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
Nested:org.jpos.iso.ISOException: java.lang.NullPointerException (java.lang.NullPointerException)
    at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:167)
    at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
Nested:java.lang.NullPointerException
    at org.jpos.iso.packager.GenericSubFieldPackager.pack(GenericSubFieldPackager.java:136)
    at org.jpos.iso.ISOMsgFieldPackager.pack(ISOMsgFieldPackager.java:60)
    at org.jpos.iso.ISOBasePackager.pack(ISOBasePackager.java:175)
    at org.jpos.iso.ISOMsg.pack(ISOMsg.java:456)
    at com.jpos.test.Test.main(Test.java:51)
/home/terrence/.cache/netbeans/8.2/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 1 second)

你能帮我理解为什么我收到这个错误,我试过更改打包器上的数据类,并改变通用子字段打包器使用europay子字段打包器和相应的数据类但我仍然得到相同的例外

1 个答案:

答案 0 :(得分:0)

这是一个无位图的字段。问题可能是缺少字段2的定义。另外,请注意此字段(我相信)IFB_LLLBINARY而不是IFB_LLBINARY