phase4 icon indicating copy to clipboard operation
phase4 copied to clipboard

Make SBDHBuilder#finishFields is public so it can be used directly

Open kukel opened this issue 4 years ago • 6 comments

SBDHBuilder#finishFields is protected but it is required when you want to process a already populated SBDH document. Since there is no real other reason to extend Phase4PeppolSender, making this public would be a nice thing to have.

kukel avatar Sep 07 '21 11:09 kukel

Well, I was looking at it and I am not conviced yet. As the finishFields is called internally from AbstractAS4MessageBuilder.sendMessage, I don't see the reason why I should make this public. Can you please elaborate on the specific use case?

You can still derive from class SBDHBuilder and extend the visibility of finishFields yourself. But I really miss the reason why someone from the outside would call this....

phax avatar Sep 08 '21 06:09 phax

Because it failed sending if I did not explicitly call it. Will try to create a unit test to show.

kukel avatar Sep 08 '21 08:09 kukel

That is weird. That is done explicitly in a base class. Are you overriding some classes and not calling the supermethod?

phax avatar Sep 08 '21 08:09 phax

Nope, working on a MainPhase4PeppolHelgerSBDH now ;-)... Few minutes

kukel avatar Sep 08 '21 08:09 kukel

Took some time, our Test SMP underwent some unexpected maintenance. This issue is semi valid.

When I use .payload(bytes[]), which I did, it fails and the .finishFields() is/seems needed (and some more). Using .payloadAndMetadata(PeppolSBDHDocument) and marshalling the bytes/inputstream to PeppolSBDHDocument first.

But this could be optimized I think since it is then made into bytes again. Why not pass on the bytes and in .payload(bytes[]) marshall for the meta data AND set the bytes. Saves a relatively expensive operation.

kukel avatar Sep 08 '21 13:09 kukel

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 12:04 stale[bot]