Skip to content

Commit

Permalink
JAMES-1669 remove useless local variables
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/james/project/trunk@1726770 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mbaechler committed Jan 26, 2016
1 parent 1aff392 commit e4583d4
Show file tree
Hide file tree
Showing 131 changed files with 280 additions and 481 deletions.
Expand Up @@ -55,8 +55,7 @@ public enum Type {
* @return not null
*/
public static MessageRange one(long uid) {
final MessageRange result = new MessageRange(Type.ONE, uid, uid);
return result;
return new MessageRange(Type.ONE, uid, uid);
}

/**
Expand All @@ -65,8 +64,7 @@ public static MessageRange one(long uid) {
* @return not null
*/
public static MessageRange all() {
final MessageRange result = new MessageRange(Type.ALL, NOT_A_UID, MAX_UID);
return result;
return new MessageRange(Type.ALL, NOT_A_UID, MAX_UID);
}

/**
Expand Down
Expand Up @@ -80,7 +80,7 @@ public void runVoid() throws MailboxException {

@Override
protected StoreMessageManager<HBaseId> createMessageManager(Mailbox<HBaseId> mailboxRow, MailboxSession session) throws MailboxException {
StoreMessageManager<HBaseId> result = new HBaseMessageManager(getMapperFactory(),
return new HBaseMessageManager(getMapperFactory(),
getMessageSearchIndex(),
getEventDispatcher(),
getLocker(),
Expand All @@ -89,6 +89,5 @@ protected StoreMessageManager<HBaseId> createMessageManager(Mailbox<HBaseId> mai
getGroupMembershipResolver(),
getQuotaManager(),
getQuotaRootResolver());
return result;
}
}
Expand Up @@ -334,19 +334,17 @@ public String[] createUserFlags() {

@Override
public String toString() {
final String retValue =
"message("
+ "mailboxId = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uid = " + this.uid + TOSTRING_SEPARATOR
+ "internalDate = " + this.internalDate + TOSTRING_SEPARATOR
+ "answered = " + this.answered + TOSTRING_SEPARATOR
+ "deleted = " + this.deleted + TOSTRING_SEPARATOR
+ "draft = " + this.draft + TOSTRING_SEPARATOR
+ "flagged = " + this.flagged + TOSTRING_SEPARATOR
+ "recent = " + this.recent + TOSTRING_SEPARATOR
+ "seen = " + this.seen + TOSTRING_SEPARATOR
+ " )";
return retValue;
return "message("
+ "mailboxId = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uid = " + this.uid + TOSTRING_SEPARATOR
+ "internalDate = " + this.internalDate + TOSTRING_SEPARATOR
+ "answered = " + this.answered + TOSTRING_SEPARATOR
+ "deleted = " + this.deleted + TOSTRING_SEPARATOR
+ "draft = " + this.draft + TOSTRING_SEPARATOR
+ "flagged = " + this.flagged + TOSTRING_SEPARATOR
+ "recent = " + this.recent + TOSTRING_SEPARATOR
+ "seen = " + this.seen + TOSTRING_SEPARATOR
+ " )";
}

@Override
Expand Down
Expand Up @@ -130,14 +130,13 @@ public long getUidValidity() {

@Override
public String toString() {
final String retValue = "Mailbox ( "
return "Mailbox ( "
+ "mailboxId = " + this.mailboxId + TAB
// + "namespace = " + this.namespace + TAB
+ "name = " + this.name + TAB
// + "user = " + this.user + TAB
+ "uidValidity = " + this.uidValidity + TAB
+ " )";
return retValue;
}

@Override
Expand Down
Expand Up @@ -59,20 +59,17 @@ public JCRMailboxSessionMapperFactory(final MailboxSessionJCRRepository reposito

@Override
public MailboxMapper<JCRId> createMailboxMapper(MailboxSession session) throws MailboxException {
JCRMailboxMapper mapper = new JCRMailboxMapper(repository, session, scaling);
return mapper;
return new JCRMailboxMapper(repository, session, scaling);
}

@Override
public MessageMapper<JCRId> createMessageMapper(MailboxSession session) throws MailboxException {
JCRMessageMapper messageMapper = new JCRMessageMapper(repository, session, uidProvider, modSeqProvider, messageScaling);
return messageMapper;
return new JCRMessageMapper(repository, session, uidProvider, modSeqProvider, messageScaling);
}

@Override
public SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException {
JCRSubscriptionMapper mapper = new JCRSubscriptionMapper(repository, session, DEFAULT_SCALING);
return mapper;
return new JCRSubscriptionMapper(repository, session, DEFAULT_SCALING);
}

public MailboxSessionJCRRepository getRepository() {
Expand Down
Expand Up @@ -57,9 +57,8 @@ public JCRMessageManager(MailboxSessionMapperFactory<JCRId> mapperFactory, Messa

@Override
protected MailboxMessage<JCRId> createMessage(Date internalDate, int size, int bodyStartOctet, SharedInputStream content, Flags flags, PropertyBuilder propertyBuilder) throws MailboxException{
final MailboxMessage<JCRId> message = new JCRMailboxMessage(getMailboxEntity().getMailboxId(), internalDate,
return new JCRMailboxMessage(getMailboxEntity().getMailboxId(), internalDate,
size, flags, content, bodyStartOctet, propertyBuilder, log);
return message;
}

/**
Expand Down
Expand Up @@ -164,12 +164,11 @@ public void merge(Node node) throws RepositoryException {

@Override
public String toString() {
final String retValue = "Mailbox ( "
return "Mailbox ( "
+ "mailboxUID = " + this.getMailboxId() + TAB
+ "name = " + this.getName() + TAB
+ "uidValidity = " + this.getUidValidity() + TAB
+ " )";
return retValue;
}

@Override
Expand Down
Expand Up @@ -587,22 +587,20 @@ public int hashCode() {


public String toString() {
final String retValue =
"message("
+ "uuid = " + getUUID()
+ "mailboxUUID = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uuid = " + this.getId() + TOSTRING_SEPARATOR
+ "internalDate = " + this.getInternalDate() + TOSTRING_SEPARATOR
+ "size = " + this.getFullContentOctets() + TOSTRING_SEPARATOR
+ "answered = " + this.isAnswered() + TOSTRING_SEPARATOR
+ "deleted = " + this.isDeleted() + TOSTRING_SEPARATOR
+ "draft = " + this.isDraft() + TOSTRING_SEPARATOR
+ "flagged = " + this.isFlagged() + TOSTRING_SEPARATOR
+ "recent = " + this.isRecent() + TOSTRING_SEPARATOR
+ "seen = " + this.isSeen() + TOSTRING_SEPARATOR
+ " )";

return retValue;
return "message("
+ "uuid = " + getUUID()
+ "mailboxUUID = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uuid = " + this.getId() + TOSTRING_SEPARATOR
+ "internalDate = " + this.getInternalDate() + TOSTRING_SEPARATOR
+ "size = " + this.getFullContentOctets() + TOSTRING_SEPARATOR
+ "answered = " + this.isAnswered() + TOSTRING_SEPARATOR
+ "deleted = " + this.isDeleted() + TOSTRING_SEPARATOR
+ "draft = " + this.isDraft() + TOSTRING_SEPARATOR
+ "flagged = " + this.isFlagged() + TOSTRING_SEPARATOR
+ "recent = " + this.isRecent() + TOSTRING_SEPARATOR
+ "seen = " + this.isSeen() + TOSTRING_SEPARATOR
+ " )";
}


Expand All @@ -611,8 +609,7 @@ public InputStream getFullContent() throws IOException {
if (isPersistent()) {
try {
//TODO: Maybe we should cache this somehow...
InputStream contentStream = node.getNode(JcrConstants.JCR_CONTENT).getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
return contentStream;
return node.getNode(JcrConstants.JCR_CONTENT).getProperty(JcrConstants.JCR_DATA).getBinary().getStream();
} catch (RepositoryException e) {
throw new IOException("Unable to retrieve property " + JcrConstants.JCR_CONTENT, e);
}
Expand Down
Expand Up @@ -220,12 +220,11 @@ public boolean equals(Object obj) {
* of this object.
*/
public String toString() {
final String result = "Property ( "

return "Property ( "
+ "localName = " + this.getLocalName() + " "
+ "namespace = " + this.getNamespace() + " "
+ "value = " + this.getValue()
+ "value = " + this.getValue()
+ " )";

return result;
}
}
Expand Up @@ -107,8 +107,7 @@ public Subscription findMailboxSubscriptionForUser(String user, String mailbox)

NodeIterator nodeIt = result.getNodes();
if (nodeIt.hasNext()) {
JCRSubscription sub = new JCRSubscription(nodeIt.nextNode(), mailbox, getLogger());
return sub;
return new JCRSubscription(nodeIt.nextNode(), mailbox, getLogger());
}

} catch (PathNotFoundException e) {
Expand Down
Expand Up @@ -170,12 +170,11 @@ public boolean equals(Object obj) {
* @return output suitable for debugging
*/
public String toString() {
final String result = "Subscription ( "

return "Subscription ( "
+ "user = " + this.getUser() + TOSTRING_SEPARATOR
+ "mailbox = " + this.getMailbox() + TOSTRING_SEPARATOR
+ " )";

return result;
}


Expand Down
Expand Up @@ -63,8 +63,7 @@ public static void after() throws IOException {
public SubscriptionManager createSubscriptionManager() {
MailboxSessionJCRRepository sessionRepos = new GlobalMailboxSessionJCRRepository(repository, workspace, user, pass);
JCRMailboxSessionMapperFactory mf = new JCRMailboxSessionMapperFactory(sessionRepos, null, null);
JCRSubscriptionManager sm = new JCRSubscriptionManager(mf);
return sm;
return new JCRSubscriptionManager(mf);
}

}
Expand Up @@ -59,8 +59,7 @@ public JPAMessageManager(MailboxSessionMapperFactory<JPAId> mapperFactory, final
protected MailboxMessage<JPAId> createMessage(Date internalDate, final int size, int bodyStartOctet, final SharedInputStream content,
final Flags flags, PropertyBuilder propertyBuilder) throws MailboxException{

final MailboxMessage<JPAId> message = new JPAMailboxMessage((JPAMailbox) getMailboxEntity(), internalDate, size, flags, content, bodyStartOctet, propertyBuilder);
return message;
return new JPAMailboxMessage((JPAMailbox) getMailboxEntity(), internalDate, size, flags, content, bodyStartOctet, propertyBuilder);
}


Expand Down
Expand Up @@ -37,7 +37,6 @@ public JPASubscriptionManager(final JPAMailboxSessionMapperFactory mapperFactory
* @see org.apache.james.mailbox.store.StoreSubscriptionManager#createSubscription(org.apache.james.mailbox.MailboxSession, java.lang.String)
*/
protected Subscription createSubscription(final MailboxSession session, final String mailbox) {
final Subscription newSubscription = new JPASubscription(session.getUser().getUserName(), mailbox);
return newSubscription;
return new JPASubscription(session.getUser().getUserName(), mailbox);
}
}
Expand Up @@ -141,12 +141,11 @@ public void setName(String name) {

@Override
public String toString() {
final String retValue = "Mailbox ( "
return "Mailbox ( "
+ "mailboxId = " + this.mailboxId + TAB
+ "name = " + this.name + TAB
+ "uidValidity = " + this.uidValidity + TAB
+ " )";
return retValue;
}

@Override
Expand Down
Expand Up @@ -171,10 +171,8 @@ public boolean equals(Object obj) {
* @return a <code>String</code> representation of this object.
*/
public String toString() {
final String result = "JPAProperty ( " + "id = " + this.id + " " + "localName = " + this.localName + " "
return "JPAProperty ( " + "id = " + this.id + " " + "localName = " + this.localName + " "
+ "namespace = " + this.namespace + " " + "value = " + this.value + " )";

return result;
}

}
Expand Up @@ -105,12 +105,10 @@ public boolean equals(Object obj) {
* of this object.
*/
public String toString() {
final String result = "JPAUserFlag ( "
return "JPAUserFlag ( "
+ "id = " + this.id + " "
+ "name = " + this.name
+ " )";

return result;
}

}
Expand Up @@ -560,19 +560,17 @@ public int compareTo(MailboxMessage<JPAId> other) {
}

public String toString() {
final String retValue =
"message("
+ "mailboxId = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uid = " + this.uid + TOSTRING_SEPARATOR
+ "internalDate = " + this.internalDate + TOSTRING_SEPARATOR
+ "answered = " + this.answered + TOSTRING_SEPARATOR
+ "deleted = " + this.deleted + TOSTRING_SEPARATOR
+ "draft = " + this.draft + TOSTRING_SEPARATOR
+ "flagged = " + this.flagged + TOSTRING_SEPARATOR
+ "recent = " + this.recent + TOSTRING_SEPARATOR
+ "seen = " + this.seen + TOSTRING_SEPARATOR
+ " )";
return retValue;
return "message("
+ "mailboxId = " + this.getMailboxId() + TOSTRING_SEPARATOR
+ "uid = " + this.uid + TOSTRING_SEPARATOR
+ "internalDate = " + this.internalDate + TOSTRING_SEPARATOR
+ "answered = " + this.answered + TOSTRING_SEPARATOR
+ "deleted = " + this.deleted + TOSTRING_SEPARATOR
+ "draft = " + this.draft + TOSTRING_SEPARATOR
+ "flagged = " + this.flagged + TOSTRING_SEPARATOR
+ "recent = " + this.recent + TOSTRING_SEPARATOR
+ "seen = " + this.seen + TOSTRING_SEPARATOR
+ " )";
}


Expand Down
Expand Up @@ -127,12 +127,11 @@ public boolean equals(Object obj) {
* @return output suitable for debugging
*/
public String toString() {
final String result = "Subscription ( "
return "Subscription ( "
+ "id = " + this.id + TO_STRING_SEPARATOR
+ "user = " + this.username + TO_STRING_SEPARATOR
+ "mailbox = " + this.mailbox + TO_STRING_SEPARATOR
+ " )";
return result;
}

}
Expand Up @@ -69,9 +69,7 @@ public SubscriptionManager createSubscriptionManager() {

JPAMailboxSessionMapperFactory mf = new JPAMailboxSessionMapperFactory(entityManagerFactory, new JPAUidProvider(locker, entityManagerFactory), new JPAModSeqProvider(locker, entityManagerFactory));

JPASubscriptionManager sm = new JPASubscriptionManager(mf);

return sm;
return new JPASubscriptionManager(mf);
}

@After
Expand Down
Expand Up @@ -76,8 +76,7 @@ public long countMessagesInMailbox(Mailbox<MaildirId> mailbox) throws MailboxExc
if (newFiles == null || curFiles == null)
throw new MailboxException("Unable to count messages in Mailbox " + mailbox, new IOException(
"Not a valid Maildir folder: " + maildirStore.getFolderName(mailbox)));
int count = newFiles.length + curFiles.length;
return count;
return newFiles.length + curFiles.length;
}

/**
Expand All @@ -93,8 +92,7 @@ public long countUnseenMessagesInMailbox(Mailbox<MaildirId> mailbox) throws Mail
if (newUnseenMessages == null || unseenMessages == null)
throw new MailboxException("Unable to count unseen messages in Mailbox " + mailbox, new IOException(
"Not a valid Maildir folder: " + maildirStore.getFolderName(mailbox)));
int count = newUnseenMessages.length + unseenMessages.length;
return count;
return newUnseenMessages.length + unseenMessages.length;
}

/**
Expand Down
Expand Up @@ -29,8 +29,7 @@ public class MaildirSubscriptionManagerTest extends AbstractSubscriptionManagerT
public SubscriptionManager createSubscriptionManager() {
MaildirStore store = new MaildirStore("target/Maildir/%domain/%user", new JVMMailboxPathLocker());
MaildirMailboxSessionMapperFactory factory = new MaildirMailboxSessionMapperFactory(store);
StoreSubscriptionManager sm = new StoreSubscriptionManager(factory);
return sm;
return new StoreSubscriptionManager(factory);
}

}
Expand Up @@ -161,9 +161,7 @@ public final Content getBody() throws IOException {
public String toString() {
final String TAB = " ";

String retValue = "MessageResultImpl ( " + "uid = " + getUid() + TAB + "flags = " + getFlags() + TAB + "size = " + getSize() + TAB + "internalDate = " + getInternalDate()+ ")";

return retValue;
return "MessageResultImpl ( " + "uid = " + getUid() + TAB + "flags = " + getFlags() + TAB + "size = " + getSize() + TAB + "internalDate = " + getInternalDate()+ ")";
}

/**
Expand Down
Expand Up @@ -184,12 +184,11 @@ private static MimeDescriptorImpl createDescriptor(long bodyOctets,
final Collection<MimeDescriptor> parts = new ArrayList<MimeDescriptor>();
final String location = descriptor.getContentLocation();
final String md5 = descriptor.getContentMD5Raw();
final MimeDescriptorImpl mimeDescriptorImpl = new MimeDescriptorImpl(
return new MimeDescriptorImpl(
bodyOctets, contentDescription, contentId, lines, subType,
type, transferEncoding, headers, contentTypeParameters,
languages, disposition, dispositionParams, embeddedMessage,
parts, location, md5);
return mimeDescriptorImpl;
}

private final long bodyOctets;
Expand Down

0 comments on commit e4583d4

Please sign in to comment.