Skip to content

Commit 418c069

Browse files
committed
Added Block Checks to checkstyle.xml.| #352
1 parent c65438d commit 418c069

File tree

13 files changed

+70
-44
lines changed

13 files changed

+70
-44
lines changed

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/EmailUtil.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -512,19 +512,21 @@ public static StringBuilder prepareFetchCommand(FetchProfile fetchProfile, boole
512512
}
513513

514514
if (fetchProfile.contains(IMAPFolder.FetchProfileItem.HEADERS)) {
515-
if (isRev1)
515+
if (isRev1) {
516516
command.append(first ?
517517
"BODY.PEEK[HEADER]" : " BODY.PEEK[HEADER]");
518-
else
518+
} else {
519519
command.append(first ? "RFC822.HEADER" : " RFC822.HEADER");
520+
}
520521
first = false;
521522
}
522523

523524
if (fetchProfile.contains(IMAPFolder.FetchProfileItem.MESSAGE)) {
524-
if (isRev1)
525+
if (isRev1) {
525526
command.append(first ? "BODY.PEEK[]" : " BODY.PEEK[]");
526-
else
527+
} else {
527528
command.append(first ? "RFC822" : " RFC822");
529+
}
528530
first = false;
529531
}
530532

@@ -780,8 +782,9 @@ public Object doCommand(IMAPProtocol imapProtocol) throws ProtocolException {
780782

781783
if (serverStatusResponse.isOK()) {
782784
for (Response response : responses) {
783-
if (!(response instanceof FetchResponse))
785+
if (!(response instanceof FetchResponse)) {
784786
continue;
787+
}
785788

786789
FetchResponse fetchResponse = (FetchResponse) response;
787790

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/protocol/CustomGmailFolder.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ public synchronized void fetchGeneralInfo(Message[] messages, FetchProfile fetch
8282
// the messages that need to be prefetched.
8383
MessageSet[] msgsets = Utility.toMessageSetSorted(messages, condition);
8484

85-
if (msgsets == null)
86-
// We already have what we need.
85+
if (msgsets == null) {// We already have what we need.
8786
return;
87+
}
8888

8989
Response[] responseArray = null;
9090
// to collect non-FETCH responses & unsolicited FETCH FLAG responses
@@ -99,12 +99,14 @@ public synchronized void fetchGeneralInfo(Message[] messages, FetchProfile fetch
9999
throw new MessagingException(pex.getMessage(), pex);
100100
}
101101

102-
if (responseArray == null)
102+
if (responseArray == null) {
103103
return;
104+
}
104105

105106
for (Response response : responseArray) {
106-
if (response == null)
107+
if (response == null) {
107108
continue;
109+
}
108110
if (!(response instanceof FetchResponse)) {
109111
responseArrayList.add(response); // Unsolicited Non-FETCH response
110112
continue;
@@ -121,13 +123,15 @@ public synchronized void fetchGeneralInfo(Message[] messages, FetchProfile fetch
121123
for (int j = 0; j < count; j++) {
122124
Item item = fetchResponse.getItem(j);
123125
// Check for the FLAGS item
124-
if (item instanceof Flags &&
125-
(!fetchProfile.contains(FetchProfile.Item.FLAGS) ||
126-
msg == null)) {
126+
if (!(item instanceof Flags) ||
127+
(fetchProfile.contains(FetchProfile.Item.FLAGS) &&
128+
msg != null)) {
129+
if (msg != null) {
130+
msg.handleFetchItemWithCustomBody(item, null, allHeaders);
131+
}
132+
} else {
127133
// Ok, Unsolicited FLAGS update.
128134
unsolicitedFlags = true;
129-
} else if (msg != null) {
130-
msg.handleFetchItemWithCustomBody(item, null, allHeaders);
131135
}
132136
}
133137

@@ -147,8 +151,9 @@ public synchronized void fetchGeneralInfo(Message[] messages, FetchProfile fetch
147151
Response[] responses = new Response[responseArrayList.size()];
148152
responseArrayList.toArray(responses);
149153
for (Response aR : responseArray) {
150-
if (aR != null)
154+
if (aR != null) {
151155
handleResponse(aR);
156+
}
152157
}
153158
}
154159

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/protocol/CustomGmailMessage.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,16 @@ public boolean handleFetchItemWithCustomBody(Item item, String[] hdrs, boolean a
8585
|| item instanceof UID
8686
|| item instanceof RFC822DATA) {
8787
return handleFetchItem(item, hdrs, allHeaders);
88-
}
89-
90-
// Check for header items
91-
else if (item instanceof BODY) {
88+
} else if (item instanceof BODY) {// Check for header items
9289
ByteArrayInputStream bodyStream;
9390
bodyStream = ((BODY) item).getByteArrayInputStream();
9491

9592
if (!((BODY) item).isHeader()) {
9693
content = ASCIIUtility.toString(bodyStream).getBytes();
9794
}
98-
} else
95+
} else {
9996
return false; // not handled
97+
}
10098
return true; // something above handled it
10199
}
102100

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/protocol/CustomIMAPFolder.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ public void fetchGeneralInfo(Message[] messages, FetchProfile fetchProfile) thro
8181
// the messages that need to be prefetched.
8282
MessageSet[] msgsets = Utility.toMessageSetSorted(messages, condition);
8383

84-
if (msgsets == null)
85-
// We already have what we need.
84+
if (msgsets == null) {// We already have what we need.
8685
return;
86+
}
8787

8888
Response[] responseArray = null;
8989
// to collect non-FETCH responses & unsolicited FETCH FLAG responses
@@ -98,12 +98,14 @@ public void fetchGeneralInfo(Message[] messages, FetchProfile fetchProfile) thro
9898
throw new MessagingException(pex.getMessage(), pex);
9999
}
100100

101-
if (responseArray == null)
101+
if (responseArray == null) {
102102
return;
103+
}
103104

104105
for (Response response : responseArray) {
105-
if (response == null)
106+
if (response == null) {
106107
continue;
108+
}
107109
if (!(response instanceof FetchResponse)) {
108110
responseArrayList.add(response); // Unsolicited Non-FETCH response
109111
continue;
@@ -146,8 +148,9 @@ public void fetchGeneralInfo(Message[] messages, FetchProfile fetchProfile) thro
146148
Response[] responses = new Response[responseArrayList.size()];
147149
responseArrayList.toArray(responses);
148150
for (Response aR : responseArray) {
149-
if (aR != null)
151+
if (aR != null) {
150152
handleResponse(aR);
153+
}
151154
}
152155
}
153156

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/protocol/CustomIMAPMessage.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,16 @@ public boolean handleFetchItemWithCustomBody(Item item, String[] hdrs, boolean a
6060
|| item instanceof UID
6161
|| item instanceof RFC822DATA) {
6262
return handleFetchItem(item, hdrs, allHeaders);
63-
}
64-
65-
// Check for header items
66-
else if (item instanceof BODY) {
63+
} else if (item instanceof BODY) {// Check for header items
6764
ByteArrayInputStream bodyStream;
6865
bodyStream = ((BODY) item).getByteArrayInputStream();
6966

7067
if (!((BODY) item).isHeader()) {
7168
content = ASCIIUtility.toString(bodyStream).getBytes();
7269
}
73-
} else
70+
} else {
7471
return false; // not handled
72+
}
7573
return true; // something above handled it
7674
}
7775

FlowCrypt/src/main/java/com/flowcrypt/email/api/email/sync/tasks/LoadMessageDetailsSyncTask.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ public Object doCommand(IMAPProtocol imapProtocol)
7979

8080
if (serverStatusResponse.isOK()) {
8181
for (Response response : responses) {
82-
if (!(response instanceof FetchResponse))
82+
if (!(response instanceof FetchResponse)) {
8383
continue;
84+
}
8485

8586
FetchResponse fetchResponse = (FetchResponse) response;
8687
BODY body = fetchResponse.getItem(BODY.class);

FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/request/BaseRequest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ public boolean equals(Object o) {
3939

4040
BaseRequest<?> that = (BaseRequest<?>) o;
4141

42-
if (queryMap != null ? !queryMap.equals(that.queryMap) : that.queryMap != null)
42+
if (queryMap != null ? !queryMap.equals(that.queryMap) : that.queryMap != null) {
4343
return false;
44-
if (apiName != that.apiName) return false;
44+
}
45+
if (apiName != that.apiName) {
46+
return false;
47+
}
4548
return requestModel != null ? requestModel.equals(that.requestModel) : that.requestModel
4649
== null;
4750

FlowCrypt/src/main/java/com/flowcrypt/email/security/KeyStoreCryptoManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ public static String generateAlgorithmParameterSpecString() {
123123
public static String normalizeAlgorithmParameterSpecString(String rawString) {
124124
if (!TextUtils.isEmpty(rawString) && rawString.length() >= SIZE_OF_ALGORITHM_PARAMETER_SPEC) {
125125
return rawString.substring(0, SIZE_OF_ALGORITHM_PARAMETER_SPEC);
126-
} else
126+
} else {
127127
throw new IllegalArgumentException("The rawString must be equals or longer then " +
128128
SIZE_OF_ALGORITHM_PARAMETER_SPEC + " bytes");
129+
}
129130
}
130131

131132
/**

FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/SelectContactsActivity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
9191
this.listViewContacts = findViewById(R.id.listViewContacts);
9292
this.listViewContacts.setAdapter(contactsListCursorAdapter);
9393
this.listViewContacts.setChoiceMode(isMultiply ? ListView.CHOICE_MODE_MULTIPLE : ListView.CHOICE_MODE_SINGLE);
94-
if (isMultiply) {
95-
//this.listViewContacts.setMultiChoiceModeListener(this);
96-
} else {
94+
if (!isMultiply) {
9795
this.listViewContacts.setOnItemClickListener(this);
9896
}
9997

FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/base/CreateMessageFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,9 +914,9 @@ private List<String> selectOnlyValidEmails(List<String> emails) {
914914
*/
915915
private OutgoingMessageInfo getOutgoingMessageInfo() {
916916
OutgoingMessageInfo outgoingMessageInfo = new OutgoingMessageInfo();
917-
if (incomingMessageInfo != null && !TextUtils.isEmpty(incomingMessageInfo.getHtmlMessage())) {
917+
/*if (incomingMessageInfo != null && !TextUtils.isEmpty(incomingMessageInfo.getHtmlMessage())) {
918918
//todo-denbond7 Need to think how forward HTML
919-
}
919+
}*/
920920
outgoingMessageInfo.setMessage(editTextEmailMessage.getText().toString());
921921
outgoingMessageInfo.setSubject(editTextEmailSubject.getText().toString());
922922

0 commit comments

Comments
 (0)