You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mime4j-dev@james.apache.org by pa...@kuruma.co.uk on 2018/09/26 11:14:00 UTC

Upgrading dependency - Code changes

Hello,

I am upgrading a projects dependency on mime4j from 0.7.2 to 0.8.2.

In doing so and then running a maven update on the project I can see I
will have to make some code changes. I cannot easily see what it is that I
should be calling now.

The two snippets of code that are failing to compile are:

final TextBody body = bodyFactory.textBody(inputStream);
final BodyPart bodyPart = new BodyPart();
bodyPart.setText(body); // the method setText() is no longer available to
call

bodyPart.setContentTransferEncoding(codec.getValue()); // The method
setContentTransferEncoding() is no longer available to call

Any help would be appreciated, this is a part of the system that is
generally not often touched and I have never worked on it or used Apache
James Storage myself.

Thanks


Re: Upgrading dependency - Code changes

Posted by pa...@kuruma.co.uk.
Hello all,

Apologies but after examining the source code of the project on github I
can see that the mutators were removed in favour of using a builder
pattern.

For anyone that this might help, an example:

final BodyPartBuilder bodyPartBuilder =
BodyPartBuilder.create().setBody(body);
if (soapAttachment.getTransferEncoding() != null) {								    
bodyPartBuilder.setContentTransferEncoding(soapAttachment.getTransferEncoding().getValue());
}

return bodyPartBuilder.build();

Thanks

On Wed, September 26, 2018 12:14 pm, paul@kuruma.co.uk wrote:

> Hello,
>
>
> I am upgrading a projects dependency on mime4j from 0.7.2 to 0.8.2.
>
>
> In doing so and then running a maven update on the project I can see I
> will have to make some code changes. I cannot easily see what it is that I
>  should be calling now.
>
> The two snippets of code that are failing to compile are:
>
>
> final TextBody body = bodyFactory.textBody(inputStream); final BodyPart
> bodyPart = new BodyPart(); bodyPart.setText(body); // the method setText()
> is no longer available to call
>
> bodyPart.setContentTransferEncoding(codec.getValue()); // The method
> setContentTransferEncoding() is no longer available to call
>
> Any help would be appreciated, this is a part of the system that is
> generally not often touched and I have never worked on it or used Apache
> James Storage myself.
>
>
> Thanks