Skip to content

Commit

Permalink
Fix Spotbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
BolZer committed Oct 16, 2024
1 parent c78d51c commit 756b364
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/github/easybill/Dtos/ValidationResult.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.easybill.Dtos;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;

Expand All @@ -9,6 +10,11 @@ public record ValidationResult(
@NonNull List<@NonNull ValidationResultField> errors,
@NonNull List<@NonNull ValidationResultField> warnings
) {
public ValidationResult {
errors = Collections.unmodifiableList(errors);
warnings = Collections.unmodifiableList(warnings);
}

@JsonProperty("is_valid")
public boolean isValid() {
return errors.isEmpty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.helger.schematron.svrl.jaxb.FailedAssert;
import com.helger.schematron.svrl.jaxb.Text;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand All @@ -18,6 +19,10 @@ public record ValidationResultField(
@JsonProperty("rule_severity") @NonNull Severity severity,
@JsonProperty("rule_messages") @NonNull List<@NonNull String> messages
) {
public ValidationResultField {
messages = Collections.unmodifiableList(messages);
}

public static ValidationResultField fromFailedAssert(
@NonNull FailedAssert failedAssert
) {
Expand Down

0 comments on commit 756b364

Please sign in to comment.