-
Notifications
You must be signed in to change notification settings - Fork 82
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
ACS-9199 Bump subethasmtp version to 7.1.3 #3207
Conversation
IMAPResponse unexpected = (IMAPResponse) r[i]; | ||
sb.append("key=" + unexpected.getKey()); | ||
sb.append("number=" + unexpected.getNumber()); | ||
sb.append("rest=" + unexpected.getRest()); | ||
|
||
sb.append("r[" + i + "]=" + r[i] + '\n'); | ||
} | ||
throw new ProtocolException("getMessageUid: " + sb.toString()); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Returns size of the message | ||
* | ||
* @param folder | ||
* Folder containing the message | ||
* @param uid | ||
* Message UID | ||
* @return Returns size of the message | ||
* @throws MessagingException | ||
*/ | ||
private static Integer getMessageSize(IMAPFolder folder, final Long uid) throws MessagingException | ||
{ | ||
return getMessageBody(folder, uid).getByteArray().getCount(); | ||
} | ||
|
||
/** | ||
* Returns a full message body | ||
* | ||
* @param folder | ||
* Folder containing the message | ||
* @param uid | ||
* Message UID | ||
* @return Returns size of the message | ||
* @throws MessagingException | ||
*/ | ||
private static BODY getMessageBody(IMAPFolder folder, final Long uid) throws MessagingException | ||
{ | ||
return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand() { | ||
public Object doCommand(IMAPProtocol p) throws ProtocolException | ||
{ | ||
Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[])", null); | ||
logResponse(r); | ||
Response response = r[r.length - 1]; | ||
|
||
// Grab response | ||
if (!response.isOK()) | ||
{ | ||
throw new ProtocolException("Unable to retrieve message size"); | ||
} | ||
FetchResponse fetchResponse = (FetchResponse) r[0]; | ||
BODY body = (BODY) fetchResponse.getItem(BODY.class); | ||
return body; | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Simple util for logging response | ||
* | ||
* @param r | ||
* response | ||
*/ | ||
private static void logResponse(Response[] r) | ||
{ | ||
for (int i = 0; i < r.length; i++) | ||
{ | ||
logger.debug(r[i]); | ||
} | ||
} | ||
|
||
@Override | ||
public void tearDown() throws Exception | ||
{ | ||
// Deleting created test environment | ||
logger.debug("tearDown "); | ||
|
||
UserTransaction txn = transactionService.getUserTransaction(); | ||
txn.begin(); | ||
|
||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, companyHomePathInStore + "/" + NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME, null, | ||
namespaceService, false); | ||
if (nodeRefs != null && nodeRefs.size() > 0) | ||
{ | ||
fileFolderService.delete(nodeRefs.get(0)); | ||
} | ||
|
||
authenticationService.deleteAuthentication(anotherUserName); | ||
personService.deletePerson(anotherUserName); | ||
|
||
txn.commit(); | ||
|
||
// Closing client connection | ||
folder.forceClose(); | ||
store.close(); | ||
logger.debug("tearDown end"); | ||
} | ||
|
||
} |
Check warning
Code scanning / PMD
High amount of different objects as members denotes a high coupling Warning test
@Category({OwnJVMTestsCategory.class, LuceneTests.class}) | ||
public class ImapMessageTest extends TestCase | ||
{ | ||
private static Log logger = LogFactory.getLog(ImapMessageTest.class); |
Check warning
Code scanning / PMD
Logger should be defined private static final and have the correct class Warning test
private static final String ADMIN_USER_PASSWORD = "admin"; | ||
private static final String IMAP_FOLDER_NAME = "test"; | ||
|
||
private Session session = null; |
Check warning
Code scanning / PMD
Avoid using redundant field initializer for 'folder' Warning test
private static final String IMAP_FOLDER_NAME = "test"; | ||
|
||
private Session session = null; | ||
private Store store = null; |
Check warning
Code scanning / PMD
Avoid using redundant field initializer for 'folder' Warning test
|
||
private Session session = null; | ||
private Store store = null; | ||
private IMAPFolder folder = null; |
Check warning
Code scanning / PMD
Avoid using redundant field initializer for 'folder' Warning test
private Store store = null; | ||
private IMAPFolder folder = null; | ||
|
||
private ApplicationContext ctx; |
Check warning
Code scanning / PMD
Perhaps 'ctx' could be replaced by a local variable. Warning test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done
Since
subethasmtp
switched to Jakarta Mail 2.1, some tests failed due to the incompatiblecom.sun.mail:jakarta.mail
implementation (See: https://github.com/Alfresco/alfresco-community-repo/actions/runs/12918991059/job/36029451587#step:13:603)This PR is to bump
subethasmtp
version to7.1.3
and useorg.eclipse.angus:angus-mail:2.0.3
which is a compatible implementation of the Jakarta Mail Specification 2.1+.Ref. https://eclipse-ee4j.github.io/angus-mail/