Skip to content

Commit

Permalink
fix: pmd warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sitepark-veltrup committed Feb 6, 2024
1 parent 9aa27ee commit 64a9e40
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

public final class Identifier {

private static final int MAX_ID_LENGTH = 19;

private static final String ZERO_ID = "0";

private final Long id;

private final Anchor anchor;
Expand Down Expand Up @@ -48,12 +52,12 @@ public Optional<Anchor> getAnchor() {

public static boolean isId(String str) {

if (str.equals("0")) {
if (ZERO_ID.equals(str)) {
throw new IllegalArgumentException("id should be greater than 0");
}

int length = str.length();
if (length > 19) {
if (length > MAX_ID_LENGTH) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,13 @@ protected Builder(MediaReference media) {
}

public Builder mediaId(String mediaId) {
if (mediaId == null) {
throw new NullPointerException("mediaId is null");
}
Objects.requireNonNull(mediaId, "mediaId is null");
this.mediaId = mediaId;
return this;
}

public Builder usedBy(String usedBy) {
if (usedBy == null) {
throw new NullPointerException("usedBy is null");
}
Objects.requireNonNull(usedBy, "usedBy is null");
this.usedBy = usedBy;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public final boolean equals(Object o) {
}

/**
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">How to Write an Equality Method in Java</a>
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">
* How to Write an Equality Method in Java
* </a>
*/
@Override
public boolean canEqual(Object other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public boolean equals(Object o) {
}

/**
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">How to Write an Equality Method in Java</a>
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">
* How to Write an Equality Method in Java
* </a>
*/
public boolean canEqual(Object other) {
return (other instanceof Query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public final boolean equals(Object o) {
}

/**
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">How to Write an Equality Method in Java</a>
* @see <a href="https://www.artima.com/articles/how-to-write-an-equality-method-in-java">
* How to Write an Equality Method in Java
* </a>
*/
@Override
public boolean canEqual(Object other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class EntityBulkExecutionTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class EntityLockTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class HistoryEntryTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class IdentifierTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class MediaReferenceTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class RecycleBinItemTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sitepark.ies.contentrepository.core.domain.databind.DatabindModule;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class FilterTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import nl.jqno.equalsverifier.EqualsVerifier;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class CursorBasedQueryTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.junit.jupiter.api.Test;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class EntityNotFoundExceptionTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.junit.jupiter.api.Test;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
class GroupNotEmptyExceptionTest {

@Test
Expand Down

0 comments on commit 64a9e40

Please sign in to comment.