mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
Cleanup for style
Some nitpicks were had. Also, change the null UUID to a constant.
This commit is contained in:
parent
73a1ceb732
commit
ba5eb3543e
@ -53,7 +53,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public abstract class OperationResult implements Parcelable {
|
||||
|
||||
public static final String EXTRA_RESULT = "operation_result";
|
||||
|
||||
public static final UUID NULL_UUID = new UUID(0,0);
|
||||
|
||||
/**
|
||||
* A HashMap of UUID:OperationLog which contains logs that we don't need
|
||||
@ -76,7 +76,7 @@ public abstract class OperationResult implements Parcelable {
|
||||
*/
|
||||
private static UUID dehydrateLog(OperationLog log) {
|
||||
if(log == null) {
|
||||
return new UUID(0,0);
|
||||
return NULL_UUID;
|
||||
}
|
||||
else {
|
||||
UUID ticket = UUID.randomUUID();
|
||||
@ -93,21 +93,14 @@ public abstract class OperationResult implements Parcelable {
|
||||
* @return An OperationLog.
|
||||
*/
|
||||
private static OperationLog rehydrateLog(UUID ticket) {
|
||||
if(ticket.getMostSignificantBits() == 0 && ticket.getLeastSignificantBits() == 0) {
|
||||
// UUID.equals isn't well documented; we use compareTo instead.
|
||||
if( NULL_UUID.compareTo(ticket) == 0 ) {
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
OperationLog log = dehydratedLogs.get(ticket);
|
||||
invalidateDehydrateTicket(ticket);
|
||||
return log;
|
||||
}
|
||||
}
|
||||
private static void invalidateDehydrateTicket(UUID ticket) {
|
||||
if(ticket.getLeastSignificantBits() != 0 && ticket.getMostSignificantBits() != 0
|
||||
&& dehydratedLogs.containsKey(ticket))
|
||||
{
|
||||
dehydratedLogs.remove(ticket);
|
||||
return log;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user