mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ACS-9199 Bump subethasmtp version to 7.1.3 (#3207)
* ACS-9199 Bump subethasmtp to 7.1.3 * ACS-9199 Bump subethasmtp to 7.1.3 * ACS-9199 Use org.eclipse.angus * ACS-9199 Update notice.txt * ACS-9199 Remove provided scope for jakarta.mail:mail-api * ACS-9199 Fix ags * ACS-9199 Remove verbose
This commit is contained in:
@@ -1377,7 +1377,7 @@
|
|||||||
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapMessageTest.java",
|
"filename": "repository/src/test/java/org/alfresco/repo/imap/ImapMessageTest.java",
|
||||||
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
"hashed_secret": "d033e22ae348aeb5660fc2140aec35850c4da997",
|
||||||
"is_verified": false,
|
"is_verified": false,
|
||||||
"line_number": 118,
|
"line_number": 116,
|
||||||
"is_secret": false
|
"is_secret": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1868,5 +1868,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"generated_at": "2025-02-11T13:28:51Z"
|
"generated_at": "2025-02-18T15:50:35Z"
|
||||||
}
|
}
|
||||||
|
@@ -63,10 +63,6 @@
|
|||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>jakarta.mail</groupId>
|
|
||||||
<artifactId>jakarta.mail-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.alfresco.surf</groupId>
|
<groupId>org.alfresco.surf</groupId>
|
||||||
<artifactId>spring-webscripts</artifactId>
|
<artifactId>spring-webscripts</artifactId>
|
||||||
|
@@ -180,13 +180,13 @@ Lightbox JS http://lokeshdhakar.com/projects/lightbox/
|
|||||||
|
|
||||||
|
|
||||||
=== Eclipse Public License 1.0 ===
|
=== Eclipse Public License 1.0 ===
|
||||||
|
Angus Mail Provider https://eclipse-ee4j.github.io/angus-mail/
|
||||||
AspectJ http://eclipse.org/aspectj/
|
AspectJ http://eclipse.org/aspectj/
|
||||||
Bliki http://code.google.com/p/gwtwiki/
|
Bliki http://code.google.com/p/gwtwiki/
|
||||||
JUnit http://junit.org/
|
JUnit http://junit.org/
|
||||||
TrueLicense http://truelicense.java.net/
|
TrueLicense http://truelicense.java.net/
|
||||||
truezip http://truezip.java.net/
|
truezip http://truezip.java.net/
|
||||||
|
|
||||||
|
|
||||||
=== ICU License ===
|
=== ICU License ===
|
||||||
icu4j http://icu-project.org/
|
icu4j http://icu-project.org/
|
||||||
|
|
||||||
|
@@ -57,8 +57,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>org.eclipse.angus</groupId>
|
||||||
<artifactId>jakarta.mail</artifactId>
|
<artifactId>angus-mail</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
10
pom.xml
10
pom.xml
@@ -97,6 +97,7 @@
|
|||||||
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
|
<dependency.jdom2.version>2.0.6.1</dependency.jdom2.version>
|
||||||
<dependency.pooled-jms.version>3.1.6</dependency.pooled-jms.version>
|
<dependency.pooled-jms.version>3.1.6</dependency.pooled-jms.version>
|
||||||
<dependency.kxml2.version>2.3.0</dependency.kxml2.version>
|
<dependency.kxml2.version>2.3.0</dependency.kxml2.version>
|
||||||
|
<dependency.angus-mail.version>2.0.3</dependency.angus-mail.version>
|
||||||
|
|
||||||
<dependency.jakarta-ee-jaxb-api.version>4.0.2</dependency.jakarta-ee-jaxb-api.version>
|
<dependency.jakarta-ee-jaxb-api.version>4.0.2</dependency.jakarta-ee-jaxb-api.version>
|
||||||
<dependency.jakarta-ee-jaxb-impl.version>4.0.5</dependency.jakarta-ee-jaxb-impl.version>
|
<dependency.jakarta-ee-jaxb-impl.version>4.0.5</dependency.jakarta-ee-jaxb-impl.version>
|
||||||
@@ -105,7 +106,7 @@
|
|||||||
<dependency.jakarta-annotation-api.version>3.0.0</dependency.jakarta-annotation-api.version>
|
<dependency.jakarta-annotation-api.version>3.0.0</dependency.jakarta-annotation-api.version>
|
||||||
<dependency.jakarta-transaction-api.version>2.0.1</dependency.jakarta-transaction-api.version>
|
<dependency.jakarta-transaction-api.version>2.0.1</dependency.jakarta-transaction-api.version>
|
||||||
<dependency.jakarta-jws-api.version>3.0.0</dependency.jakarta-jws-api.version>
|
<dependency.jakarta-jws-api.version>3.0.0</dependency.jakarta-jws-api.version>
|
||||||
<dependency.jakarta-ee-mail.version>2.0.1</dependency.jakarta-ee-mail.version>
|
<dependency.jakarta-ee-mail.version>2.1.3</dependency.jakarta-ee-mail.version>
|
||||||
<dependency.jakarta-ee-activation.version>2.0.1</dependency.jakarta-ee-activation.version>
|
<dependency.jakarta-ee-activation.version>2.0.1</dependency.jakarta-ee-activation.version>
|
||||||
<dependency.jakarta-ee-jms.version>3.1.0</dependency.jakarta-ee-jms.version>
|
<dependency.jakarta-ee-jms.version>3.1.0</dependency.jakarta-ee-jms.version>
|
||||||
<dependency.java-ee-activation.version>1.2.0</dependency.java-ee-activation.version>
|
<dependency.java-ee-activation.version>1.2.0</dependency.java-ee-activation.version>
|
||||||
@@ -219,15 +220,14 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>org.eclipse.angus</groupId>
|
||||||
<artifactId>jakarta.mail</artifactId>
|
<artifactId>angus-mail</artifactId>
|
||||||
<version>${dependency.jakarta-ee-mail.version}</version>
|
<version>${dependency.angus-mail.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.mail</groupId>
|
<groupId>jakarta.mail</groupId>
|
||||||
<artifactId>jakarta.mail-api</artifactId>
|
<artifactId>jakarta.mail-api</artifactId>
|
||||||
<version>${dependency.jakarta-ee-mail.version}</version>
|
<version>${dependency.jakarta-ee-mail.version}</version>
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.activation</groupId>
|
<groupId>com.sun.activation</groupId>
|
||||||
|
@@ -56,8 +56,8 @@
|
|||||||
<artifactId>jakarta.mail-api</artifactId>
|
<artifactId>jakarta.mail-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.mail</groupId>
|
<groupId>org.eclipse.angus</groupId>
|
||||||
<artifactId>jakarta.mail</artifactId>
|
<artifactId>angus-mail</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.davidmoten</groupId>
|
<groupId>com.github.davidmoten</groupId>
|
||||||
<artifactId>subethasmtp</artifactId>
|
<artifactId>subethasmtp</artifactId>
|
||||||
<version>6.0.6</version>
|
<version>7.1.3</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<!-- Duplicate classes from com.sun.mail:jakarta.mail -->
|
<!-- Duplicate classes from com.sun.mail:jakarta.mail -->
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2023 Alfresco Software Limited
|
* Copyright (C) 2005 - 2025 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.imap;
|
package org.alfresco.repo.imap;
|
||||||
|
|
||||||
|
import static org.alfresco.model.ContentModel.PROP_MODIFIED;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -37,7 +39,6 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import jakarta.mail.Address;
|
import jakarta.mail.Address;
|
||||||
import jakarta.mail.Folder;
|
import jakarta.mail.Folder;
|
||||||
import jakarta.mail.Message;
|
import jakarta.mail.Message;
|
||||||
@@ -51,6 +52,23 @@ import jakarta.mail.internet.MimeUtility;
|
|||||||
import jakarta.transaction.UserTransaction;
|
import jakarta.transaction.UserTransaction;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.eclipse.angus.mail.iap.ProtocolException;
|
||||||
|
import org.eclipse.angus.mail.iap.Response;
|
||||||
|
import org.eclipse.angus.mail.imap.IMAPFolder;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.BODY;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.FetchResponse;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.IMAPProtocol;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.IMAPResponse;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.RFC822DATA;
|
||||||
|
import org.eclipse.angus.mail.imap.protocol.UID;
|
||||||
|
import org.eclipse.angus.mail.util.ASCIIUtility;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.experimental.categories.Category;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.model.ImapModel;
|
import org.alfresco.model.ImapModel;
|
||||||
@@ -83,26 +101,6 @@ import org.alfresco.util.PropertyMap;
|
|||||||
import org.alfresco.util.config.RepositoryFolderConfigBean;
|
import org.alfresco.util.config.RepositoryFolderConfigBean;
|
||||||
import org.alfresco.util.testing.category.LuceneTests;
|
import org.alfresco.util.testing.category.LuceneTests;
|
||||||
import org.alfresco.util.testing.category.RedundantTests;
|
import org.alfresco.util.testing.category.RedundantTests;
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
|
||||||
|
|
||||||
import com.sun.mail.iap.ProtocolException;
|
|
||||||
import com.sun.mail.iap.Response;
|
|
||||||
import com.sun.mail.imap.IMAPFolder;
|
|
||||||
import com.sun.mail.imap.protocol.BODY;
|
|
||||||
import com.sun.mail.imap.protocol.FetchResponse;
|
|
||||||
import com.sun.mail.imap.protocol.IMAPProtocol;
|
|
||||||
import com.sun.mail.imap.protocol.IMAPResponse;
|
|
||||||
import com.sun.mail.imap.protocol.RFC822DATA;
|
|
||||||
import com.sun.mail.imap.protocol.UID;
|
|
||||||
import com.sun.mail.util.ASCIIUtility;
|
|
||||||
|
|
||||||
import static org.alfresco.model.ContentModel.PROP_MODIFIED;
|
|
||||||
|
|
||||||
@Category({OwnJVMTestsCategory.class, LuceneTests.class})
|
@Category({OwnJVMTestsCategory.class, LuceneTests.class})
|
||||||
public class ImapMessageTest extends TestCase
|
public class ImapMessageTest extends TestCase
|
||||||
@@ -159,7 +157,6 @@ public class ImapMessageTest extends TestCase
|
|||||||
namespaceService = serviceRegistry.getNamespaceService();
|
namespaceService = serviceRegistry.getNamespaceService();
|
||||||
fileFolderService = serviceRegistry.getFileFolderService();
|
fileFolderService = serviceRegistry.getFileFolderService();
|
||||||
|
|
||||||
|
|
||||||
// start the transaction
|
// start the transaction
|
||||||
UserTransaction txn = transactionService.getUserTransaction();
|
UserTransaction txn = transactionService.getUserTransaction();
|
||||||
txn.begin();
|
txn.begin();
|
||||||
@@ -200,7 +197,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
ImapServiceImpl imapServiceImpl = (ImapServiceImpl) imapCtx.getBean("imapService");
|
ImapServiceImpl imapServiceImpl = (ImapServiceImpl) imapCtx.getBean("imapService");
|
||||||
imapServer = (AlfrescoImapServer) imapCtx.getBean("imapServer");
|
imapServer = (AlfrescoImapServer) imapCtx.getBean("imapServer");
|
||||||
|
|
||||||
if(!imapServer.isImapServerEnabled())
|
if (!imapServer.isImapServerEnabled())
|
||||||
{
|
{
|
||||||
imapServer.setImapServerEnabled(true);
|
imapServer.setImapServerEnabled(true);
|
||||||
imapServer.setHost(HOST);
|
imapServer.setHost(HOST);
|
||||||
@@ -220,7 +217,6 @@ public class ImapMessageTest extends TestCase
|
|||||||
imapHome.setFolderPath(NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME);
|
imapHome.setFolderPath(NamespaceService.CONTENT_MODEL_PREFIX + ":" + IMAP_FOLDER_NAME);
|
||||||
imapServiceImpl.setImapHome(imapHome);
|
imapServiceImpl.setImapHome(imapHome);
|
||||||
|
|
||||||
|
|
||||||
// Starting IMAP
|
// Starting IMAP
|
||||||
imapServiceImpl.startupInTxn(true);
|
imapServiceImpl.startupInTxn(true);
|
||||||
|
|
||||||
@@ -228,10 +224,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
namespaceService, false);
|
namespaceService, false);
|
||||||
testImapFolderNodeRef = nodeRefs.get(0);
|
testImapFolderNodeRef = nodeRefs.get(0);
|
||||||
|
|
||||||
/*
|
/* Importing test folders: Test folder contains: "___-___folder_a" "___-___folder_a" contains: "___-___folder_a_a", "___-___file_a", "Message_485.eml" (this is IMAP Message) "___-___folder_a_a" contains: "____-____file_a_a" */
|
||||||
* Importing test folders: Test folder contains: "___-___folder_a" "___-___folder_a" contains: "___-___folder_a_a", "___-___file_a", "Message_485.eml" (this is IMAP
|
|
||||||
* Message) "___-___folder_a_a" contains: "____-____file_a_a"
|
|
||||||
*/
|
|
||||||
importInternal("imap/imapservice_test_folder_a.acp", testImapFolderNodeRef);
|
importInternal("imap/imapservice_test_folder_a.acp", testImapFolderNodeRef);
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
@@ -243,7 +236,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
// Get the store
|
// Get the store
|
||||||
this.store = session.getStore(PROTOCOL);
|
this.store = session.getStore(PROTOCOL);
|
||||||
//this.store.connect(HOST, PORT, anotherUserName, anotherUserName);
|
// this.store.connect(HOST, PORT, anotherUserName, anotherUserName);
|
||||||
this.store.connect(imapServer.getHost(), imapServer.getPort(), anotherUserName, anotherUserName);
|
this.store.connect(imapServer.getHost(), imapServer.getPort(), anotherUserName, anotherUserName);
|
||||||
|
|
||||||
// Get folder
|
// Get folder
|
||||||
@@ -349,8 +342,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
fail("Should raise an IOException");
|
fail("Should raise an IOException");
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dontTestMessageCache() throws Exception
|
public void dontTestMessageCache() throws Exception
|
||||||
@@ -411,8 +403,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
{
|
{
|
||||||
Locale.setDefault(Locale.FRENCH);
|
Locale.setDefault(Locale.FRENCH);
|
||||||
String dateStr = "12-Jul-2020";
|
String dateStr = "12-Jul-2020";
|
||||||
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand()
|
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Object doCommand(IMAPProtocol protocol)
|
public Object doCommand(IMAPProtocol protocol)
|
||||||
{
|
{
|
||||||
@@ -445,8 +436,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
Locale.setDefault(Locale.FRENCH);
|
Locale.setDefault(Locale.FRENCH);
|
||||||
String dateStr = "12-juil.-2020";
|
String dateStr = "12-juil.-2020";
|
||||||
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand()
|
final IMAPFolder.ProtocolCommand uid_search_since = new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Object doCommand(IMAPProtocol protocol)
|
public Object doCommand(IMAPProtocol protocol)
|
||||||
{
|
{
|
||||||
@@ -512,7 +502,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
// InternetAddress.toString(new Address[] {address}) - is used in the RFC822MetadataExtracter
|
// InternetAddress.toString(new Address[] {address}) - is used in the RFC822MetadataExtracter
|
||||||
// So, compare with that
|
// So, compare with that
|
||||||
assertFalse("Non ASCII characters in the address should be encoded", decodedAddress.equals(InternetAddress.toString(new Address[] {address})));
|
assertFalse("Non ASCII characters in the address should be encoded", decodedAddress.equals(InternetAddress.toString(new Address[]{address})));
|
||||||
|
|
||||||
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
|
MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
|
||||||
|
|
||||||
@@ -540,7 +530,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
// triggers a metadata extract to take place in a post commit method. Previously this would have been a
|
// triggers a metadata extract to take place in a post commit method. Previously this would have been a
|
||||||
// synchronous process. This is no longer true as it may now take place in a T-Engine. So, we need to wait
|
// synchronous process. This is no longer true as it may now take place in a T-Engine. So, we need to wait
|
||||||
// for the extract to take place. There does not
|
// for the extract to take place. There does not
|
||||||
long end = System.currentTimeMillis()+10000;
|
long end = System.currentTimeMillis() + 10000;
|
||||||
while (System.currentTimeMillis() <= end && origModified.equals(getModified(nodeRef)))
|
while (System.currentTimeMillis() <= end && origModified.equals(getModified(nodeRef)))
|
||||||
{
|
{
|
||||||
Thread.currentThread().sleep(1000);
|
Thread.currentThread().sleep(1000);
|
||||||
@@ -607,8 +597,6 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
lfolder.appendMessages(messages);
|
lfolder.appendMessages(messages);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// The search is not implemented.
|
// The search is not implemented.
|
||||||
// SearchTerm term = new HeaderTerm("X-Alfresco-Unique", "test8bit");
|
// SearchTerm term = new HeaderTerm("X-Alfresco-Unique", "test8bit");
|
||||||
// messages = folder.search(term);
|
// messages = folder.search(term);
|
||||||
@@ -619,14 +607,13 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
QueryParameterDefinition[] params = new QueryParameterDefinition[1];
|
QueryParameterDefinition[] params = new QueryParameterDefinition[1];
|
||||||
params[0] = new QueryParameterDefImpl(
|
params[0] = new QueryParameterDefImpl(
|
||||||
ContentModel.PROP_TITLE,
|
ContentModel.PROP_TITLE,
|
||||||
serviceRegistry.getDictionaryService().getDataType(DataTypeDefinition.TEXT),
|
serviceRegistry.getDictionaryService().getDataType(DataTypeDefinition.TEXT),
|
||||||
true,
|
true,
|
||||||
subject);
|
subject);
|
||||||
|
|
||||||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, messageXPath, params, namespaceService, true);
|
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, messageXPath, params, namespaceService, true);
|
||||||
|
|
||||||
|
|
||||||
// does the message exist
|
// does the message exist
|
||||||
assertEquals(1, nodeRefs.size());
|
assertEquals(1, nodeRefs.size());
|
||||||
|
|
||||||
@@ -646,8 +633,10 @@ public class ImapMessageTest extends TestCase
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if (messageFileInputStream1 != null) messageFileInputStream1.close();
|
if (messageFileInputStream1 != null)
|
||||||
if (messageFileInputStream2 != null) messageFileInputStream2.close();
|
messageFileInputStream1.close();
|
||||||
|
if (messageFileInputStream2 != null)
|
||||||
|
messageFileInputStream2.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// close connection
|
// close connection
|
||||||
@@ -656,11 +645,9 @@ public class ImapMessageTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static RFC822DATA getRFC822Message(final IMAPFolder folder, final long uid) throws MessagingException
|
private static RFC822DATA getRFC822Message(final IMAPFolder folder, final long uid) throws MessagingException
|
||||||
{
|
{
|
||||||
return (RFC822DATA) folder.doCommand(new IMAPFolder.ProtocolCommand()
|
return (RFC822DATA) folder.doCommand(new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
||||||
{
|
{
|
||||||
Response[] r = p.command("UID FETCH " + uid + " (RFC822)", null);
|
Response[] r = p.command("UID FETCH " + uid + " (RFC822)", null);
|
||||||
@@ -681,17 +668,20 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Returns BODY object containing desired message fragment
|
* Returns BODY object containing desired message fragment
|
||||||
*
|
*
|
||||||
* @param folder Folder containing the message
|
* @param folder
|
||||||
* @param uid Message UID
|
* Folder containing the message
|
||||||
* @param from starting byte
|
* @param uid
|
||||||
* @param count bytes to read
|
* Message UID
|
||||||
|
* @param from
|
||||||
|
* starting byte
|
||||||
|
* @param count
|
||||||
|
* bytes to read
|
||||||
* @return BODY containing desired message fragment
|
* @return BODY containing desired message fragment
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private static BODY getMessageBodyPart(IMAPFolder folder, final Long uid, final Integer from, final Integer count) throws MessagingException
|
private static BODY getMessageBodyPart(IMAPFolder folder, final Long uid, final Integer from, final Integer count) throws MessagingException
|
||||||
{
|
{
|
||||||
return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand()
|
return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
||||||
{
|
{
|
||||||
Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[]<" + from + "." + count + ">)", null);
|
Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[]<" + from + "." + count + ">)", null);
|
||||||
@@ -705,7 +695,7 @@ public class ImapMessageTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
FetchResponse fetchResponse = (FetchResponse) r[0];
|
FetchResponse fetchResponse = (FetchResponse) r[0];
|
||||||
BODY body = (BODY) fetchResponse.getItem(com.sun.mail.imap.protocol.BODY.class);
|
BODY body = (BODY) fetchResponse.getItem(BODY.class);
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -715,7 +705,8 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Finds node by its path
|
* Finds node by its path
|
||||||
*
|
*
|
||||||
* @param path String
|
* @param path
|
||||||
|
* String
|
||||||
* @return NodeRef
|
* @return NodeRef
|
||||||
*/
|
*/
|
||||||
private NodeRef findNode(String path)
|
private NodeRef findNode(String path)
|
||||||
@@ -727,15 +718,16 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Returns the UID of the first message in folder
|
* Returns the UID of the first message in folder
|
||||||
*
|
*
|
||||||
* @param folder Folder containing the message
|
* @param folder
|
||||||
* @param msn message sequence number
|
* Folder containing the message
|
||||||
|
* @param msn
|
||||||
|
* message sequence number
|
||||||
* @return UID of the first message
|
* @return UID of the first message
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private static Long getMessageUid(IMAPFolder folder, final int msn) throws MessagingException
|
private static Long getMessageUid(IMAPFolder folder, final int msn) throws MessagingException
|
||||||
{
|
{
|
||||||
return (Long) folder.doCommand(new IMAPFolder.ProtocolCommand()
|
return (Long) folder.doCommand(new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
||||||
{
|
{
|
||||||
String command = "FETCH " + msn + " (UID)";
|
String command = "FETCH " + msn + " (UID)";
|
||||||
@@ -749,38 +741,37 @@ public class ImapMessageTest extends TestCase
|
|||||||
throw new ProtocolException("Unable to retrieve message UID");
|
throw new ProtocolException("Unable to retrieve message UID");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0 ; i < r.length; i++)
|
for (int i = 0; i < r.length; i++)
|
||||||
{
|
{
|
||||||
if(r[i] instanceof FetchResponse)
|
if (r[i] instanceof FetchResponse)
|
||||||
{
|
{
|
||||||
FetchResponse fetchResponse = (FetchResponse) r[0];
|
FetchResponse fetchResponse = (FetchResponse) r[0];
|
||||||
UID uid = (UID) fetchResponse.getItem(UID.class);
|
UID uid = (UID) fetchResponse.getItem(UID.class);
|
||||||
logger.debug("SECNUM=" + uid.seqnum + ", UID="+uid.uid);
|
logger.debug("SECNUM=" + uid.seqnum + ", UID=" + uid.uid);
|
||||||
return uid.uid;
|
return uid.uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uh-oh - this is where we would intermittently fall over with a class cast exception.
|
* Uh-oh - this is where we would intermittently fall over with a class cast exception. The following code probes why we don't have a FetchResponse
|
||||||
* The following code probes why we don't have a FetchResponse
|
*/
|
||||||
*/
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append("command="+command);
|
sb.append("command=" + command);
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
sb.append("resp length=" + r.length);
|
sb.append("resp length=" + r.length);
|
||||||
sb.append('\n');
|
sb.append('\n');
|
||||||
for(int i = 0 ; i < r.length; i++)
|
for (int i = 0; i < r.length; i++)
|
||||||
{
|
{
|
||||||
logger.error(r[i]);
|
logger.error(r[i]);
|
||||||
sb.append("class=" + r[i].getClass().getName());
|
sb.append("class=" + r[i].getClass().getName());
|
||||||
IMAPResponse unexpected = (IMAPResponse)r[i];
|
IMAPResponse unexpected = (IMAPResponse) r[i];
|
||||||
sb.append("key=" + unexpected.getKey());
|
sb.append("key=" + unexpected.getKey());
|
||||||
sb.append("number=" + unexpected.getNumber());
|
sb.append("number=" + unexpected.getNumber());
|
||||||
sb.append("rest=" + unexpected.getRest());
|
sb.append("rest=" + unexpected.getRest());
|
||||||
|
|
||||||
sb.append("r[" + i + "]=" + r[i] + '\n');
|
sb.append("r[" + i + "]=" + r[i] + '\n');
|
||||||
}
|
}
|
||||||
throw new ProtocolException("getMessageUid: "+ sb.toString());
|
throw new ProtocolException("getMessageUid: " + sb.toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -788,8 +779,10 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Returns size of the message
|
* Returns size of the message
|
||||||
*
|
*
|
||||||
* @param folder Folder containing the message
|
* @param folder
|
||||||
* @param uid Message UID
|
* Folder containing the message
|
||||||
|
* @param uid
|
||||||
|
* Message UID
|
||||||
* @return Returns size of the message
|
* @return Returns size of the message
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
@@ -801,15 +794,16 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Returns a full message body
|
* Returns a full message body
|
||||||
*
|
*
|
||||||
* @param folder Folder containing the message
|
* @param folder
|
||||||
* @param uid Message UID
|
* Folder containing the message
|
||||||
|
* @param uid
|
||||||
|
* Message UID
|
||||||
* @return Returns size of the message
|
* @return Returns size of the message
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private static BODY getMessageBody(IMAPFolder folder, final Long uid) throws MessagingException
|
private static BODY getMessageBody(IMAPFolder folder, final Long uid) throws MessagingException
|
||||||
{
|
{
|
||||||
return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand()
|
return (BODY) folder.doCommand(new IMAPFolder.ProtocolCommand() {
|
||||||
{
|
|
||||||
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
public Object doCommand(IMAPProtocol p) throws ProtocolException
|
||||||
{
|
{
|
||||||
Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[])", null);
|
Response[] r = p.command("UID FETCH " + uid + " (FLAGS BODY.PEEK[])", null);
|
||||||
@@ -831,7 +825,8 @@ public class ImapMessageTest extends TestCase
|
|||||||
/**
|
/**
|
||||||
* Simple util for logging response
|
* Simple util for logging response
|
||||||
*
|
*
|
||||||
* @param r response
|
* @param r
|
||||||
|
* response
|
||||||
*/
|
*/
|
||||||
private static void logResponse(Response[] r)
|
private static void logResponse(Response[] r)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user