Fix inspections

This commit is contained in:
AsamK 2018-11-20 23:27:36 +01:00
parent f60a10eb6e
commit 7e897fa6d0
13 changed files with 20 additions and 34 deletions

View file

@ -5,10 +5,6 @@ import org.whispersystems.signalservice.internal.util.Base64;
public class GroupNotFoundException extends DBusExecutionException {
public GroupNotFoundException(String message) {
super(message);
}
public GroupNotFoundException(byte[] groupId) {
super("Group not found: " + Base64.encodeBytes(groupId));
}

View file

@ -5,10 +5,6 @@ import org.whispersystems.signalservice.internal.util.Base64;
public class NotAGroupMemberException extends DBusExecutionException {
public NotAGroupMemberException(String message) {
super(message);
}
public NotAGroupMemberException(byte[] groupId, String groupName) {
super("User is not a member in group: " + groupName + " (" + Base64.encodeBytes(groupId) + ")");
}

View file

@ -2,8 +2,8 @@ package org.asamk.signal;
public class UserAlreadyExists extends Exception {
private String username;
private String fileName;
private final String username;
private final String fileName;
public UserAlreadyExists(String username, String fileName) {
this.username = username;

View file

@ -73,16 +73,14 @@ public class Manager implements Signal {
private final String dataPath;
private final String attachmentsPath;
private final String avatarsPath;
private final SleepTimer timer = new UptimeSleepTimer();
private SignalAccount account;
private String username;
private SignalServiceAccountManager accountManager;
private SignalServiceMessagePipe messagePipe = null;
private SignalServiceMessagePipe unidentifiedMessagePipe = null;
private SleepTimer timer = new UptimeSleepTimer();
public Manager(String username, String settingsPath) {
this.username = username;
this.settingsPath = settingsPath;

View file

@ -223,8 +223,8 @@ class Utils {
static class DeviceLinkInfo {
String deviceIdentifier;
ECPublicKey deviceKey;
final String deviceIdentifier;
final ECPublicKey deviceKey;
DeviceLinkInfo(final String deviceIdentifier, final ECPublicKey deviceKey) {
this.deviceIdentifier = deviceIdentifier;

View file

@ -40,7 +40,7 @@ public class JsonContactsStore {
contacts.clear();
}
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
@Override
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
@ -48,7 +48,7 @@ public class JsonContactsStore {
}
}
public static class ContactsDeserializer extends JsonDeserializer<Map<String, ContactInfo>> {
private static class ContactsDeserializer extends JsonDeserializer<Map<String, ContactInfo>> {
@Override
public Map<String, ContactInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {

View file

@ -37,7 +37,7 @@ public class JsonGroupStore {
return new ArrayList<>(groups.values());
}
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
@Override
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
@ -45,7 +45,7 @@ public class JsonGroupStore {
}
}
public static class GroupsDeserializer extends JsonDeserializer<Map<String, GroupInfo>> {
private static class GroupsDeserializer extends JsonDeserializer<Map<String, GroupInfo>> {
@Override
public Map<String, GroupInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {

View file

@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import org.asamk.signal.TrustLevel;
import org.whispersystems.libsignal.IdentityKey;
@ -189,13 +188,13 @@ public class JsonIdentityKeyStore implements IdentityKeyStore {
this.added = new Date();
}
public Identity(IdentityKey identityKey, TrustLevel trustLevel, Date added) {
Identity(IdentityKey identityKey, TrustLevel trustLevel, Date added) {
this.identityKey = identityKey;
this.trustLevel = trustLevel;
this.added = added;
}
public boolean isTrusted() {
boolean isTrusted() {
return trustLevel == TrustLevel.TRUSTED_UNVERIFIED ||
trustLevel == TrustLevel.TRUSTED_VERIFIED;
}

View file

@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import org.whispersystems.libsignal.InvalidKeyIdException;
import org.whispersystems.libsignal.state.PreKeyRecord;
@ -21,7 +20,7 @@ class JsonPreKeyStore implements PreKeyStore {
}
public void addPreKeys(Map<Integer, byte[]> preKeys) {
private void addPreKeys(Map<Integer, byte[]> preKeys) {
store.putAll(preKeys);
}

View file

@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.state.SessionRecord;
@ -20,7 +19,7 @@ class JsonSessionStore implements SessionStore {
}
public void addSessions(Map<SignalProtocolAddress, byte[]> sessions) {
private void addSessions(Map<SignalProtocolAddress, byte[]> sessions) {
this.sessions.putAll(sessions);
}

View file

@ -21,22 +21,22 @@ public class JsonSignalProtocolStore implements SignalProtocolStore {
@JsonProperty("preKeys")
@JsonDeserialize(using = JsonPreKeyStore.JsonPreKeyStoreDeserializer.class)
@JsonSerialize(using = JsonPreKeyStore.JsonPreKeyStoreSerializer.class)
protected JsonPreKeyStore preKeyStore;
private JsonPreKeyStore preKeyStore;
@JsonProperty("sessionStore")
@JsonDeserialize(using = JsonSessionStore.JsonSessionStoreDeserializer.class)
@JsonSerialize(using = JsonSessionStore.JsonPreKeyStoreSerializer.class)
protected JsonSessionStore sessionStore;
private JsonSessionStore sessionStore;
@JsonProperty("signedPreKeyStore")
@JsonDeserialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreDeserializer.class)
@JsonSerialize(using = JsonSignedPreKeyStore.JsonSignedPreKeyStoreSerializer.class)
protected JsonSignedPreKeyStore signedPreKeyStore;
private JsonSignedPreKeyStore signedPreKeyStore;
@JsonProperty("identityKeyStore")
@JsonDeserialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreDeserializer.class)
@JsonSerialize(using = JsonIdentityKeyStore.JsonIdentityKeyStoreSerializer.class)
protected JsonIdentityKeyStore identityKeyStore;
private JsonIdentityKeyStore identityKeyStore;
public JsonSignalProtocolStore() {
}

View file

@ -2,7 +2,6 @@ package org.asamk.signal.storage.protocol;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;
import org.whispersystems.libsignal.InvalidKeyIdException;
import org.whispersystems.libsignal.state.SignedPreKeyRecord;
@ -23,7 +22,7 @@ class JsonSignedPreKeyStore implements SignedPreKeyStore {
}
public void addSignedPreKeys(Map<Integer, byte[]> preKeys) {
private void addSignedPreKeys(Map<Integer, byte[]> preKeys) {
store.putAll(preKeys);
}

View file

@ -34,7 +34,7 @@ public class JsonThreadStore {
return new ArrayList<>(threads.values());
}
public static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
private static class MapToListSerializer extends JsonSerializer<Map<?, ?>> {
@Override
public void serialize(final Map<?, ?> value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException {
@ -42,7 +42,7 @@ public class JsonThreadStore {
}
}
public static class ThreadsDeserializer extends JsonDeserializer<Map<String, ThreadInfo>> {
private static class ThreadsDeserializer extends JsonDeserializer<Map<String, ThreadInfo>> {
@Override
public Map<String, ThreadInfo> deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {