Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VariableFieldPackager NPE on msg.pack followed by hexdump when field is not set and only the dlimiter is expected in the stream #322

Closed
wants to merge 1 commit into from

Conversation

mchhil-incomm
Copy link

The value needs to be set with an empty string if the user did not set it specifically and was null. This mimics unpack where value is set to "" when only a delimiter is found. Due to this not being set in pack, the hexdump called on the msg after pack, results in a NPE.

        VariableFieldPackager f1  = new VariableFieldPackager("F1", 20, Byte.valueOf((byte) 0x1c),
                                                              AsciiInterpreter.INSTANCE);

        FSDMsgX               msg = new FSDMsgX("Test1");
        msg.add("F1", f1);


        byte[] arr = msg.pack();

        System.out.println(msg.getParserTree(""));
        System.out.println(msg.hexDump(""));

Output

[Test1]
Field [F1] : VAR[0..20] delimiter[0x1C] or EOM  : 

0000  1C                                                .



The value needs to be set with an empty string if the user did not set it specifically and was null. This mimics unpack where value is set to "" when only a delimiter is found. Due to this not being set in pack, the hexdump called on the msg after pack, results in a NPE.
@mchhil-incomm mchhil-incomm closed this by deleting the head repository Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant