addressed some sonar issues

This commit is contained in:
Sheldan
2020-05-27 18:41:31 +02:00
parent f05f088d58
commit 175a92408c
31 changed files with 125 additions and 95 deletions

View File

@@ -21,6 +21,6 @@ public class FeatureListener {
@EventListener
public void handleContextRefreshEvent(ContextRefreshedEvent ctxStartEvt) {
// Do nothing yet, because of a race condition between features and commands
}
}

View File

@@ -177,9 +177,4 @@ public class BotServiceBean implements BotService {
}
return null;
}
@Override
public void shutdown() {
}
}

View File

@@ -154,6 +154,7 @@ public class MessageCacheBean implements MessageCache {
reactions.add(cachedReaction);
} catch (InterruptedException | ExecutionException e) {
log.error("Error while executing future to retrieve reaction.", e);
Thread.currentThread().interrupt();
}
});
return reactions;

View File

@@ -42,7 +42,8 @@ public class ChannelManagementServiceBean implements ChannelManagementService {
.build();
return repository.save(build);
} else {
return loadChannel(id).get();
Optional<AChannel> channelOptional = loadChannel(id);
return channelOptional.orElse(null);
}
}

View File

@@ -8,7 +8,7 @@ import java.util.HashMap;
public class IncorrectParameter extends AbstractoRunTimeException implements Templatable {
private final Command command;
private final transient Command command;
private final String parameterName;
private final Class clazz;

View File

@@ -10,7 +10,7 @@ import java.util.HashMap;
@Getter
public class InsufficientParameters extends AbstractoRunTimeException implements Templatable {
private final Command command;
private final transient Command command;
private final String parameterName;
public InsufficientParameters(String s, Command command, String parameterName) {

View File

@@ -9,7 +9,7 @@ import java.util.HashMap;
public class ParameterTooLong extends AbstractoRunTimeException implements Templatable {
private final Command command;
private final transient Command command;
private final String parameterName;
private final Integer actualLength;
private final Integer maximumLength;

View File

@@ -12,7 +12,7 @@ import java.util.List;
@Getter
@Setter
@Builder
public class CachedMessage implements Serializable {
public class CachedMessage {
private Long serverId;
private Long channelId;
private Long messageId;

View File

@@ -6,6 +6,7 @@ import net.dv8tion.jda.api.entities.ChannelType;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.List;
import java.util.Objects;
@@ -17,7 +18,7 @@ import java.util.Objects;
@AllArgsConstructor
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AChannel implements SnowFlake {
public class AChannel implements SnowFlake, Serializable {
@Id
@Getter

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.List;
import java.util.Objects;
@@ -16,7 +17,7 @@ import java.util.Objects;
@Getter
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AChannelGroup {
public class AChannelGroup implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -5,6 +5,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
@Entity
@@ -15,7 +16,7 @@ import java.util.Objects;
@Getter
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AChannelGroupCommand {
public class AChannelGroupCommand implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
@@ -15,7 +16,7 @@ import java.util.Objects;
@Getter
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AConfig {
public class AConfig implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -3,6 +3,7 @@ package dev.sheldan.abstracto.core.models.database;
import lombok.*;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
@Entity
@@ -11,7 +12,7 @@ import java.time.Instant;
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class ADefaultConfig {
public class ADefaultConfig implements Serializable {
@javax.persistence.Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer Id;

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
@@ -15,7 +16,7 @@ import java.util.Objects;
@Getter
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AEmote {
public class AEmote implements Serializable {
@javax.persistence.Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -6,6 +6,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
@@ -16,7 +17,7 @@ import java.util.Objects;
@AllArgsConstructor
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AFeature implements SnowFlake {
public class AFeature implements SnowFlake, Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
@@ -14,7 +15,7 @@ import java.util.Objects;
@AllArgsConstructor
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AFeatureFlag {
public class AFeatureFlag implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
@Entity
@@ -13,7 +14,7 @@ import java.time.Instant;
@AllArgsConstructor
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AFeatureMode {
public class AFeatureMode implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Getter

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.List;
import java.util.Objects;
@@ -16,7 +17,7 @@ import java.util.Objects;
@Getter
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AUser {
public class AUser implements Serializable {
@Id
private Long id;

View File

@@ -4,6 +4,7 @@ import lombok.*;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;
@@ -14,7 +15,7 @@ import java.util.Objects;
@NoArgsConstructor
@Cacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PostTarget {
public class PostTarget implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@@ -32,5 +32,4 @@ public interface BotService {
Optional<Guild> getGuildById(Long serverId);
Guild getGuildByIdNullable(Long serverId);
Member getBotInGuild(AServer server);
void shutdown();
}