mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Avoid concatenation in StringBuilder append
This commit is contained in:
parent
2e2428b093
commit
9b27aba2ba
@ -745,7 +745,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
|
|
||||||
StringBuilder libs = new StringBuilder().append("<ul>");
|
StringBuilder libs = new StringBuilder().append("<ul>");
|
||||||
for (String[] library : USED_LIBRARIES) {
|
for (String[] library : USED_LIBRARIES) {
|
||||||
libs.append("<li><a href=\"" + library[1] + "\">" + library[0] + "</a></li>");
|
libs.append("<li><a href=\"").append(library[1]).append("\">").append(library[0]).append("</a></li>");
|
||||||
}
|
}
|
||||||
libs.append("</ul>");
|
libs.append("</ul>");
|
||||||
|
|
||||||
|
@ -253,8 +253,8 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
for (int i = 0; i < chain.length; i++) {
|
for (int i = 0; i < chain.length; i++) {
|
||||||
// display certificate chain information
|
// display certificate chain information
|
||||||
//TODO: localize this strings
|
//TODO: localize this strings
|
||||||
chainInfo.append("Certificate chain[" + i + "]:\n");
|
chainInfo.append("Certificate chain[").append(i).append("]:\n");
|
||||||
chainInfo.append("Subject: " + chain[i].getSubjectDN().toString() + "\n");
|
chainInfo.append("Subject: ").append(chain[i].getSubjectDN().toString()).append("\n");
|
||||||
|
|
||||||
// display SubjectAltNames too
|
// display SubjectAltNames too
|
||||||
// (the user may be mislead into mistrusting a certificate
|
// (the user may be mislead into mistrusting a certificate
|
||||||
@ -265,7 +265,8 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
if (subjectAlternativeNames != null) {
|
if (subjectAlternativeNames != null) {
|
||||||
// The list of SubjectAltNames may be very long
|
// The list of SubjectAltNames may be very long
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
StringBuilder altNamesText = new StringBuilder("Subject has " + subjectAlternativeNames.size() + " alternative names\n");
|
StringBuilder altNamesText = new StringBuilder();
|
||||||
|
altNamesText.append("Subject has ").append(subjectAlternativeNames.size()).append(" alternative names\n");
|
||||||
|
|
||||||
// we need these for matching
|
// we need these for matching
|
||||||
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
|
String storeURIHost = (Uri.parse(mAccount.getStoreUri())).getHost();
|
||||||
@ -309,11 +310,11 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
// display them
|
// display them
|
||||||
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
|
if (name.equalsIgnoreCase(storeURIHost) || name.equalsIgnoreCase(transportURIHost)) {
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
altNamesText.append("Subject(alt): " + name + ",...\n");
|
altNamesText.append("Subject(alt): ").append(name).append(",...\n");
|
||||||
} else if (name.startsWith("*.")) {
|
} else if (name.startsWith("*.")) {
|
||||||
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
|
if (storeURIHost.endsWith(name.substring(2)) || transportURIHost.endsWith(name.substring(2))) {
|
||||||
//TODO: localize this string
|
//TODO: localize this string
|
||||||
altNamesText.append("Subject(alt): " + name + ",...\n");
|
altNamesText.append("Subject(alt): ").append(name).append(",...\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,12 +325,12 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
|||||||
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
|
Log.w(K9.LOG_TAG, "cannot display SubjectAltNames in dialog", e1);
|
||||||
}
|
}
|
||||||
|
|
||||||
chainInfo.append("Issuer: " + chain[i].getIssuerDN().toString() + "\n");
|
chainInfo.append("Issuer: ").append(chain[i].getIssuerDN().toString()).append("\n");
|
||||||
if (sha1 != null) {
|
if (sha1 != null) {
|
||||||
sha1.reset();
|
sha1.reset();
|
||||||
try {
|
try {
|
||||||
char[] sha1sum = Hex.encodeHex(sha1.digest(chain[i].getEncoded()));
|
char[] sha1sum = Hex.encodeHex(sha1.digest(chain[i].getEncoded()));
|
||||||
chainInfo.append("Fingerprint (SHA-1): " + new String(sha1sum) + "\n");
|
chainInfo.append("Fingerprint (SHA-1): ").append(new String(sha1sum)).append("\n");
|
||||||
} catch (CertificateEncodingException e) {
|
} catch (CertificateEncodingException e) {
|
||||||
Log.e(K9.LOG_TAG, "Error while encoding certificate", e);
|
Log.e(K9.LOG_TAG, "Error while encoding certificate", e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user