Skip to content

Commit

Permalink
Minor cleanup and spelling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelmay committed Dec 12, 2022
1 parent 14f3598 commit b003507
Show file tree
Hide file tree
Showing 24 changed files with 158 additions and 159 deletions.
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -28,7 +28,7 @@ Development [![Build status](https://circleci.com/gh/greenmail-mail-test/greenma
Make sure you got [Maven 3.8][maven_download] or higher, and run a JDK 8 or newer.
If you want to skip building the docker image, leave out the `-Pdocker` profile option.

If you want to skip the long running tests, use the Maven option `-DskipITs` .
If you want to skip the long-running tests, use the Maven option `-DskipITs` .

* Build the Maven site (and the optional example report)

Expand All @@ -45,7 +45,7 @@ Development [![Build status](https://circleci.com/gh/greenmail-mail-test/greenma

`mvn clean deploy -Prelease,release-ossrh,docker,docker-tag-latest`

Note: Do only use docker-tag-latest profile if you really want the tag latest, e.g. for newest release of highest version.
Note: Do only use docker-tag-latest profile if you really want the tag latest, e.g. for newest release of the highest version.

* Build and deploy a snapshot

Expand Down Expand Up @@ -90,7 +90,7 @@ To make it easier for integrating your contribution, have a look at the followin
### Be concise

Try to keep your changes focused. Please avoid (major) refactorings and avoid re-formatting existing code.
A good check is looking at the diff of the your pull requrest.
A good check is looking at the diff of your pull request.
Also, please refer to the open issue you're fixing by including a reference in your commit message.

### Code formatter ###
Expand All @@ -107,7 +107,7 @@ If you think you require a new dependencies or dependency update,
discuss this up front with committers.

### Starting your pull request ###
The best strategy for opening a [pull request][github_pull_request] after a [fork][github_fork] is to add the this [repository](https://github.com/greenmail-mail-test/greenmail)
The best strategy for opening a [pull request][github_pull_request] after a [fork][github_fork] is to add this [repository](https://github.com/greenmail-mail-test/greenmail)
as the "upstream" to your .git/config such as:

[remote "upstream"]
Expand All @@ -116,7 +116,7 @@ as the "upstream" to your .git/config such as:

Then you fetch "upstream" and create a new branch at upstream/master (name it issue-XXX or something like that).
Now you can add commits on that branch and then create a pull request for that branch (after pushing it to your
github). That way commits are isolated for one feature.
GitHub). That way commits are isolated for one feature.

### Tests for your pull request ###
Please also create a test for every feature you add. We know that currently there aren't many tests but in
Expand Down
14 changes: 7 additions & 7 deletions docs/index.html
Expand Up @@ -1034,7 +1034,7 @@ <h2 id="features-api">API</h2>
<p>Operations include
<ul>
<li>Getting currently configured user and adding new users</li>
<li>Getting current configuration (eg which service like SMTP runs on which port)</li>
<li>Getting current configuration (e.g. which service like SMTP runs on which port)</li>
<li>Purging all mailboxes of emails</li>
<li>Resetting GreenMail to original configuration (restarts server, purges all mails and users added
via API)
Expand All @@ -1048,10 +1048,10 @@ <h2 id="features-api">API</h2>
alt="GreenMail OpenAPI UI"/>
<figcaption class="figure-caption text-end">GreenMail OpenAPI UI.</figcaption>
</figure>
<p>The OpenAPI rendered UI can be used for invoking the API, eg for adding a new user:</p>
<p>The OpenAPI rendered UI can be used for invoking the API, e.g. for adding a new user:</p>
<figure class="figure">
<img src="images/greenmail_standalone_openapi_try.png" class="figure-img img-fluid"
alt="GreenMail OpenAPI UI invocating new user request"/>
alt="GreenMail OpenAPI UI invoking new user request"/>
<figcaption class="figure-caption text-end">GreenMail OpenAPI UI invoking new user request.</figcaption>
</figure>

Expand Down Expand Up @@ -1084,7 +1084,7 @@ <h4>What other library dependencies are there?</h4>
<h4>How come I don't need to install any SSL/TLS related certificates?</h4>
<p>GreenMail is designed to be used out of the box with no need to generate, sign or install any
certificates into your keystore.
GreenMail ships with a builtin keystore with a self signed RSA key. Refer to the source code of
GreenMail ships with a builtin keystore with a self-signed RSA key. Refer to the source code of
<a
href="https://github.com/greenmail-mail-test/greenmail/blob/master/greenmail-core/src/main/java/com/icegreen/greenmail/util/DummySSLSocketFactory.java">DummySSLServerSocketFactory</a>
for details.</p>
Expand Down Expand Up @@ -1134,10 +1134,10 @@ <h4>How can I let GreenMail dynamically choose available port?</h4>
greenMail.getSmtp().getServerSetup());
</code></pre><!-- @formatter:on -->

<h4>How can I pre-load an existing (eml) message?</h4>
<p>You can load an existing electronic mail (eml) messsage and store the message for a user in a mailbox folder.</p>
<h4>How can I preload an existing (eml) message?</h4>
<p>You can load an existing electronic mail (eml) message and store the message for a user in a mailbox folder.</p>
<p>
Example:
Example:
<a href="https://github.com/greenmail-mail-test/greenmail/blob/master/greenmail-core/src/test/java/com/icegreen/greenmail/examples/ExamplePreloadMailFromFsTest.java">ExamplePreloadMailFromFsTest.java</a>
</p>
</section>
Expand Down
Expand Up @@ -24,7 +24,7 @@ public UserBean(final String email, final String login, final String password) {
}

/**
* @return Email address of mail box
* @return Email address of mailbox
*/
public String getEmail() {
return this.email;
Expand Down
Expand Up @@ -21,7 +21,8 @@
* @version $Revision: 109034 $
*/
public class ImapHostManagerImpl
implements ImapHostManager, ImapConstants {
implements ImapHostManager, ImapConstants {

private final Store store;
private final MailboxSubscriptions subscriptions;

Expand Down Expand Up @@ -67,10 +68,10 @@ public MailFolder getFolder(GreenMailUser user, String mailboxName) {

@Override
public MailFolder getFolder(GreenMailUser user, String mailboxName, boolean mustExist)
throws FolderException {
throws FolderException {
MailFolder folder = getFolder(user, mailboxName);
if (mustExist && (folder == null)) {
throw new FolderException("No such folder : "+mailboxName);
throw new FolderException("No such folder : " + mailboxName);
}
return folder;
}
Expand Down Expand Up @@ -98,14 +99,14 @@ public void createPrivateMailAccount(GreenMailUser user) throws FolderException
*/
@Override
public MailFolder createMailbox(GreenMailUser user, String mailboxName)
throws FolderException {
throws FolderException {
String qualifiedName = getQualifiedMailboxName(user, mailboxName);
if (store.getMailbox(qualifiedName) != null) {
throw new FolderException("Mailbox " + mailboxName + " already exists.");
}

StringTokenizer tokens = new StringTokenizer(qualifiedName,
HIERARCHY_DELIMITER);
HIERARCHY_DELIMITER);

if (tokens.countTokens() < 2) {
throw new FolderException("Cannot create store at namespace level.");
Expand Down Expand Up @@ -138,10 +139,10 @@ public MailFolder createMailbox(GreenMailUser user, String mailboxName)
*/
@Override
public void deleteMailbox(GreenMailUser user, String mailboxName)
throws FolderException {
throws FolderException {

if (mailboxName.equalsIgnoreCase("inbox")) {
throw new FolderException("Can not delete INBOX mailbox");
throw new FolderException("Can not delete INBOX mailbox for user " + user.getEmail());
}

MailFolder toDelete = getFolder(user, mailboxName, true);
Expand All @@ -154,7 +155,8 @@ public void deleteMailbox(GreenMailUser user, String mailboxName)
toDelete.deleteAllMessages();
store.setSelectable(toDelete, false);
} else {
throw new FolderException("Can't delete a non-selectable store with children.");
throw new FolderException("Can't delete a non-selectable store " +
toDelete.getName() + " with children for user " + user.getEmail());
}
}
}
Expand All @@ -166,12 +168,13 @@ public void deleteMailbox(GreenMailUser user, String mailboxName)
public void renameMailbox(GreenMailUser user,
String oldMailboxName,
String newMailboxName)
throws FolderException {
throws FolderException {

MailFolder existingFolder = getFolder(user, oldMailboxName, true);

if (getFolder(user, newMailboxName) != null) {
throw new FolderException("Cannot rename mailbox to the name already existed mailbox");
throw new FolderException("Cannot rename mailbox " + oldMailboxName + " to " +
newMailboxName + ", the name already existed mailbox for user " + user.getEmail());
}

// TODO: check permissions.
Expand All @@ -198,8 +201,8 @@ public void renameMailbox(GreenMailUser user,
*/
@Override
public Collection<MailFolder> listSubscribedMailboxes(GreenMailUser user,
String mailboxPattern)
throws FolderException {
String mailboxPattern)
throws FolderException {
return listMailboxes(user, mailboxPattern, true);
}

Expand All @@ -208,8 +211,8 @@ public Collection<MailFolder> listSubscribedMailboxes(GreenMailUser user,
*/
@Override
public Collection<MailFolder> listMailboxes(GreenMailUser user,
String mailboxPattern)
throws FolderException {
String mailboxPattern)
throws FolderException {
return listMailboxes(user, mailboxPattern, false);
}

Expand All @@ -221,9 +224,9 @@ public Collection<MailFolder> listMailboxes(GreenMailUser user,
* @see com.icegreen.greenmail.imap.ImapHostManager#listMailboxes
*/
private Collection<MailFolder> listMailboxes(GreenMailUser user,
String mailboxPattern,
boolean subscribedOnly)
throws FolderException {
String mailboxPattern,
boolean subscribedOnly)
throws FolderException {
List<MailFolder> mailboxes = new ArrayList<>();
String qualifiedPattern = getQualifiedMailboxName(user, mailboxPattern);

Expand All @@ -246,7 +249,7 @@ private Collection<MailFolder> listMailboxes(GreenMailUser user,
*/
@Override
public void subscribe(GreenMailUser user, String mailboxName)
throws FolderException {
throws FolderException {
MailFolder folder = getFolder(user, mailboxName, true);
subscriptions.subscribe(user, folder);
}
Expand All @@ -256,7 +259,7 @@ public void subscribe(GreenMailUser user, String mailboxName)
*/
@Override
public void unsubscribe(GreenMailUser user, String mailboxName)
throws FolderException {
throws FolderException {
MailFolder folder = getFolder(user, mailboxName, true);
subscriptions.unsubscribe(user, folder);
}
Expand All @@ -277,7 +280,7 @@ private String getQualifiedMailboxName(GreenMailUser user, String mailboxName) {

if ("INBOX".equalsIgnoreCase(mailboxName)) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + INBOX_NAME;
HIERARCHY_DELIMITER + INBOX_NAME;
}

if (mailboxName.startsWith(NAMESPACE_PREFIX)) {
Expand All @@ -287,7 +290,7 @@ private String getQualifiedMailboxName(GreenMailUser user, String mailboxName) {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace;
} else {
return USER_NAMESPACE + HIERARCHY_DELIMITER + userNamespace +
HIERARCHY_DELIMITER + mailboxName;
HIERARCHY_DELIMITER + mailboxName;
}
}
}
Expand Down
Expand Up @@ -511,7 +511,7 @@ private static class FetchRequest {

private boolean setSeen = false;

private Set<BodyFetchElement> bodyElements = new HashSet<>();
private final Set<BodyFetchElement> bodyElements = new HashSet<>();

public Collection<BodyFetchElement> getBodyElements() {
return bodyElements;
Expand Down
Expand Up @@ -90,7 +90,7 @@ public boolean includes(long uid) {
}

/**
* Parses a uid sequence, a comma separated list of uid ranges.
* Parses an uid sequence, a comma separated list of uid ranges.
* Note that the wildcard '*' denotes the largest number in use.
* <p/>
* Example: 1,2:5,8:*
Expand Down Expand Up @@ -200,7 +200,7 @@ private static long parseLong(String value) {
* @return true, if ranges contain given uid
*/
public static boolean containsUid(IdRange[] idRanges, long uid) {
if (null != idRanges && idRanges.length > 0) {
if (null != idRanges) {
for (IdRange range : idRanges) {
if (range.includes(uid)) {
return true;
Expand Down
Expand Up @@ -90,7 +90,7 @@ public ImapCommand getCommand(String commandName) {

private ImapCommand createCommand(Class<? extends ImapCommand> commandClass) {
try {
ImapCommand cmd = commandClass.newInstance();
ImapCommand cmd = commandClass.getDeclaredConstructor().newInstance();

if (cmd instanceof UidCommand) {
((UidCommand) cmd).setCommandFactory(this);
Expand Down
Expand Up @@ -12,7 +12,7 @@
/**
* Implements IMAP Quota Extension.
*
* See http://rfc-ref.org/RFC-TEXTS/2087
* See <a href="https://datatracker.ietf.org/doc/html/rfc2087#section-4-1">rfc2087</a>
*
* @author mm
*/
Expand Down
Expand Up @@ -12,7 +12,7 @@
/**
* Implements IMAP Quota Extension.
* <p/>
* See http://rfc-ref.org/RFC-TEXTS/2087
* See <a href="https://datatracker.ietf.org/doc/html/rfc2087#section-4-1">rfc2087</a>
*
* Supports MESSAGES and STORAGE.
* @author mm
Expand Down
Expand Up @@ -10,7 +10,7 @@
/**
* Implements IMAP Quota Extension.
* <p/>
* See http://rfc-ref.org/RFC-TEXTS/2087
* See <a href="https://datatracker.ietf.org/doc/html/rfc2087#section-4-1">rfc2087</a>
*
* @author mm
*/
Expand Down
Expand Up @@ -95,7 +95,7 @@ public void doProcess(ImapRequestLineReader request,
private static class StoreCommandParser extends CommandParser {
StoreDirective storeDirective(ImapRequestLineReader request) throws ProtocolException {
int sign = 0;
boolean silent = false;
boolean silent;

char next = request.nextWordChar();
if (next == '+') {
Expand Down
Expand Up @@ -87,7 +87,7 @@ void renameMailbox(MailFolder existingFolder, String newName)
throws FolderException;

/**
* Lists all of the mailboxes in the store which have a name
* Lists all the mailboxes in the store which have a name
* matching the supplied search pattern.
* <pre>
* Valid wildcards are:
Expand Down
Expand Up @@ -6,14 +6,14 @@
*/
package com.icegreen.greenmail.store;

import java.util.Date;

import jakarta.mail.Flags;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeMessage;

import java.util.Date;

/**
* A mail message with all of the extra stuff that IMAP requires.
* A mail message with all the extra stuff that IMAP requires.
* This is just a placeholder object, while I work out what's really required. A common
* way of handling *all* messages needs to be available for James (maybe MovingMessage?)
*
Expand Down
Expand Up @@ -8,7 +8,7 @@
/**
* Handles delivery when receiving messages.
*
* Can be used for alternative implementation (eg Delivery Status Notification DSN).
* Can be used for alternative implementation (e.g. Delivery Status Notification DSN).
*/
public interface MessageDeliveryHandler {
GreenMailUser handle(MovingMessage msg, MailAddress mailAddress) throws MessagingException, UserException;
Expand Down

0 comments on commit b003507

Please sign in to comment.