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

Allow to override internal static fields #578

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jbescos
Copy link
Member

@jbescos jbescos commented Aug 27, 2021

I have closed this PR #515 and address it in this new PR. This is because of the conflicts after the split of API and Implementation.

Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jbescos jbescos marked this pull request as draft August 27, 2021 09:57
Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jbescos jbescos marked this pull request as ready for review August 27, 2021 13:29
if (context == null)
context = new MessageContext(part);
return context;
public MessageContext getMessageContext() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was synchronized removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no point to have it synchronized because the context is instanced now in the constructor. It is not possible that 2 threads obtain a different instance by calling that method.

api/pom.xml Outdated
@@ -404,6 +404,8 @@ Use is subject to <a href="{@docRoot}/doc-files/speclicense.html" target="_top">
<configuration>
<forkCount>2</forkCount>
<reuseForks>false</reuseForks>
<!-- Test service loader is not loaded if modules are enabled -->
<useModulePath>false</useModulePath>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this to work, tests need their own module-info, there are more ways to make it work

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thank you.

Copy link
Contributor

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmehrens how does this look to you?

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Copy link
Contributor

@jmehrens jmehrens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the version. Much cleaner than what we started with.

prop.put("mail.mime.decodefilename", Boolean.TRUE);
prop.put("mail.mime.ignoremultipartencoding", Boolean.FALSE);
prop.put("mail.mime.allowutf8", Boolean.FALSE);
prop.put("mail.mime.cachemultipart", Boolean.FALSE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, we are expecting String key and String values. It must work because toString gets called on the value.

Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jbescos
Copy link
Member Author

jbescos commented Sep 8, 2021

Notice that these changes breaks the TCK and I created a PR for that:
jakartaee/mail-tck#24

It is about setting the system property at the begging of the test.

As mail-tck is going to dramatically change here: jakartaee/mail-tck#29
I suggest to wait for that to be merged. Then, I will create a new PR to update a couple of tests (setFileNameTest_encodeTrue_decodeFalse and setFileNameTest_encodeFalse_decodeTrue) to set the system property at the beggining. And finally, we can merge this.

Signed-off-by: Jorge Bescos Gascon <[email protected]>
Copy link
Contributor

@jmehrens jmehrens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For #589 we'll need an override for InternetAddress utf8 boolean.

@@ -1002,7 +1003,13 @@ protected MimeBodyPart createMimeBodyPart(InternetHeaders headers,
*/
protected MimeBodyPart createMimeBodyPart(InputStream is)
throws MessagingException {
return new MimeBodyPart(is);
if (ds != null && ds instanceof MimePartDataSource) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should simply be:
if (ds instanceof MessageAware)

followed by a cast to MessageAware instead of MimePartDataSource

Signed-off-by: Jorge Bescos Gascon <[email protected]>
@jbescos jbescos marked this pull request as draft January 3, 2023 09:45
@jbescos
Copy link
Member Author

jbescos commented Jan 3, 2023

Setting this as a draft meanwhile this comment is not implemented: #578 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants