jPOS icon indicating copy to clipboard operation
jPOS copied to clipboard

Standalone BItMap - for LIS5, but perhaps portable?

Open marksalter opened this issue 11 years ago • 8 comments
trafficstars

I need to consider the potential moveable nature of this BitMap field and form a method of keeping track of it/them in the ISOBasePacker processing, since field 65 (for LIS) is currently hardcoded.

marksalter avatar Sep 27 '14 11:09 marksalter

Looking at test failures

marksalter avatar Sep 27 '14 11:09 marksalter

Added check for fld[65] existence, but this is tied into:-

Issues:

  1. Backward compatibility and performance of pack operations
  2. variable fld location for 'Standalone' BitMap, tracking and processing.

marksalter avatar Sep 27 '14 13:09 marksalter

I have issues running the tests on windows, so please consider this pull request held and take care in using any part of it!

marksalter avatar Sep 29 '14 20:09 marksalter

FYI, I've ran the tests locally, not all, but some of the problems happen in ISOBasePackager line 103 where you check for fld[65] without checking that fld.length > 65, it gives an ArrayIndexOutOfBounds exceptions.

ar avatar Sep 30 '14 01:09 ar

On 30/09/2014 02:34, Alejandro Revilla wrote:

FYI, I've ran the tests locally, not all, but some of the problems happen in ISOBasePackager line 103 where you check for fld[65] without checking that fld.length > 65, it gives an ArrayIndexOutOfBounds exceptions. Ok, I did patch that, but will check again.

It is this specific addition to the BasePackager I dislike immensely and will (I think) restrict the pull request making it in the master.

again, time prevents me making progress...

.. should I withdraw the pull request, is Jarvis repeating the build or is that on a commit/revision basis only?

Mark

marksalter avatar Sep 30 '14 19:09 marksalter

Travis should pick your commits toward this PR

ar avatar Sep 30 '14 19:09 ar

I tried out this change but is was not working completely. The BitMap was not set into DE 65 automatically if I set a fields above 128 and in addition the bit in the primary bit map for DE 65 was not set.

I change the adjustBitMapForPack(..) method of the ISOBitMapStandalonePackager and afterwords it was working.

public void adjustBitMapForPack(Map fields, BitSet bitset) {

    if (key == 0) {
        /*
         * we don't have a key, so we have nothing to add to this bitmap exchange.
         */
    } else {

        /*
         * Loop though bitset, unsetting 'our' bits and setting our bits on (relative to base).
         */
        int base = (key - 1) << 1 ;

        BitSet myBmap = new BitSet();

        // set bit for DE 65 in primary bitmap
        bitset.set(65);

         for (int set = bitset.nextSetBit(base); set >= 0; set = bitset.nextSetBit(set+1)) {
                myBmap.set(set-base);
                bitset.clear(set);
         }

        try {
            if (bmap == null) {
                bmap = new ISOBitMapStandalone(key);
            }

            bmap.setValue(myBmap);

            // set the the 3rd bitmap into DE 65
            fields.put(65, bmap);
        } catch (ISOException ex) {
            ex.printStackTrace();
        }

Manuel83 avatar Oct 02 '14 21:10 Manuel83

On 02/10/2014 22:18, Manuel83 wrote:

The BitMap was not set into DE 65 automatically if I set a fields above 128 and in addition the bit in the primary bit map for DE 65 was not set. Thanks for the feedback.

I have not used this for messages with fields above 128, good to know it was a simple fix.

Mark

marksalter avatar Oct 02 '14 21:10 marksalter