aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-02-21 15:47:15 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2014-02-21 15:47:15 +0100
commitc2013c9ca88e44a8a6a1eb110a331eba9811a1f1 (patch)
tree8df06002d95e80c86e8f34de6264c943a98e18cd /OpenPGP-Keychain/src
parentf29d3015b8ca067986f588481242a6cc9061dbb4 (diff)
downloadopen-keychain-c2013c9ca88e44a8a6a1eb110a331eba9811a1f1.tar.gz
open-keychain-c2013c9ca88e44a8a6a1eb110a331eba9811a1f1.tar.bz2
open-keychain-c2013c9ca88e44a8a6a1eb110a331eba9811a1f1.zip
precompile user id pattern
Diffstat (limited to 'OpenPGP-Keychain/src')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
index 3fc63cda1..b3e21685e 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java
@@ -42,6 +42,8 @@ import android.content.Context;
public class PgpKeyHelper {
+ private static final Pattern USER_ID_PATTERN = Pattern.compile("^(.*?)(?: \\((.*)\\))?(?: <(.*)>)?$");
+
public static Date getCreationDate(PGPPublicKey key) {
return key.getCreationTime();
}
@@ -540,8 +542,7 @@ public class PgpKeyHelper {
* "Max Mustermann (this is a comment)"
* "Max Mustermann [this is nothing]"
*/
- Pattern withComment = Pattern.compile("^(.*?)(?: \\((.*)\\))?(?: <(.*)>)?$");
- Matcher matcher = withComment.matcher(userId);
+ Matcher matcher = USER_ID_PATTERN.matcher(userId);
if (matcher.matches()) {
result[0] = matcher.group(1);
result[1] = matcher.group(3);