Hi, I'm having a problem with a nested field. When
GenericSubFieldPackager encounters the field, it throws a null ptr
exception due to its fld[] array not being initialized with packagers
as expected.
Requirement:
Send a virtual gift card activation message like:
mti: 0200
proc code: 82
merchant bin: sent in field 112 subfield 15.
My Approach:
Use GenericPackager with custom xml.
My XML for the subfield:
<isofieldpackager
id="112"
length="9999"
name="Gift Card Transaction Data"
class="org.jpos.iso.IFB_LLLLBINARY"
packager="org.jpos.iso.packager.GenericSubFieldPackager">
<isofield
id="15"
length="5"
name="Virtual Gift Card BIN"
pad="false"
class="org.jpos.iso.IFB_LLNUM"/>
</isofieldpackager>
My Code for the msg and subfield:
ISOMsg fullMessage = new ISOMsg();
fullMessage.setMTI ("0200");
fullMessage.set (3, "82");
...
ISOMsg subMsg = new ISOMsg();
subMsg.setFieldNumber(112);
subMsg.set(15, "051006308540‘"); // e.g.
fullMessage.set (subMsg); // note there is no set(field#, component)
in api
Result:
Things go fine until GenericSubFieldPackager tries to pack() the
112.15 subfield
GenericSubfieldPackager.java:23: b =
getBitMapfieldPackager().pack(c);
at which point getBitMapfieldPackager() returns null, because its fld
is full of nulls at every index other than 15 (15 contains the
packager specified in my XML).
So is this an issue of my subfield lacking a bitmap field? Do all
subfields require separate bitmaps, and if so, how does one specify
them in this scenario? Looking thru the programmer's guide, searching
for 'subfield', 'nested', 'bitmap', I haven't found an example or
explanation.
I tried adding a bitmap subfield to the xml for field 112, i.e.
<isofield
id="1"
length="16"
name="BIT MAP"
class="org.jpos.iso.IFB_BITMAP"/>
I also tried bypassing this issue by hardcoding values instead of
using a nested sub-message, i.e.:
fullMessage.set("112.15", "051006308540");
and replacing the <isofieldpackager> xml with a normal node.
Jpos throws the same null ptr in all cases.
I also noticed this thread,
http://groups.google.com/group/jpos-users/browse_thread/thread/7f7d4d2524630be6/0582e0e4dfc9d587?lnk=gst&q=nested#0582e0e4dfc9d587
which mentions examples in jpos/src/examples, but my source (1.6.6)
has no example dir.
Thanks for your help or suggestions.
Marc