Move utf8 check for user id upwards

This commit is contained in:
Dominik Schürmann 2014-10-07 18:11:12 +02:00
parent 27d062496f
commit 678265483a

View File

@ -366,6 +366,11 @@ public class UncachedKeyRing {
for (byte[] rawUserId : new IterableIterator<byte[]>(masterKey.getRawUserIDs())) {
String userId = Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(rawUserId);
// warn if user id was made with bad encoding
if (!Utf8Util.isValidUTF8(rawUserId)) {
log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent);
}
// check for duplicate user ids
if (processedUserIds.contains(userId)) {
log.add(LogType.MSG_KC_UID_DUP,
@ -437,10 +442,6 @@ public class UncachedKeyRing {
badCerts += 1;
continue;
}
// warn user if the signature was made with bad encoding
if (!Utf8Util.isValidUTF8(rawUserId)) {
log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent);
}
} catch (PgpGeneralException e) {
log.add(LogType.MSG_KC_UID_BAD_ERR,
indent, userId);