Skip to content

Commit

Permalink
fixing #505 and dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
erosb committed Apr 7, 2024
1 parent 2e7b0d2 commit 5436bb7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
10 changes: 5 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
<version>20240303</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
<version>33.1.0-jre</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -236,7 +236,7 @@
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
<version>1.8.0</version>
<exclusions>
<exclusion>
<artifactId>commons-beanutils</artifactId>
Expand All @@ -259,7 +259,7 @@
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.15.3</version>
<version>3.16.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -270,7 +270,7 @@
<dependency>
<groupId>com.google.re2j</groupId>
<artifactId>re2j</artifactId>
<version>1.6</version>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
Expand Down
19 changes: 18 additions & 1 deletion core/src/main/java/org/everit/json/schema/StringSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,30 @@ public boolean equals(Object o) {
Objects.equals(minLength, that.minLength) &&
Objects.equals(maxLength, that.maxLength) &&
Objects.equals(pattern, that.pattern) &&
Objects.equals(formatValidator, that.formatValidator) &&
sameFormatAs(that) &&
super.equals(that);
} else {
return false;
}
}

private boolean sameFormatAs(StringSchema that) {
if ((formatValidator == null) != (that.formatValidator == null)) {
return false;
}
if (formatValidator == null) {
return true;
}
if (!formatValidator.getClass().equals(that.formatValidator.getClass())) {
return false;
}
return Objects.equals(formatValidator.formatName(), that.formatValidator.formatName());
// return (formatValidator == null) == (that.formatValidator == null) &&
// (formatValidator == null ||
// Objects.equals(formatValidator.formatName(), that.formatValidator.formatName())
// );
}

public FormatValidator getFormatValidator() {
return formatValidator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import java.util.Optional;

import org.everit.json.schema.internal.EmailFormatValidator;
import org.everit.json.schema.internal.URIFormatValidator;
import org.everit.json.schema.loader.SchemaLoader;
import org.everit.json.schema.regexp.RE2JRegexpFactory;
import org.json.JSONObject;
Expand Down Expand Up @@ -109,6 +111,7 @@ public void equalsVerifier() {
.withRedefinedSuperclass()
.withIgnoredFields("schemaLocation", "location")
.withPrefabValues(Pattern.class, Pattern.compile("red"), Pattern.compile("black"))
.withPrefabValues(FormatValidator.class, new EmailFormatValidator(), new URIFormatValidator())
.suppress(Warning.STRICT_INHERITANCE)
.verify();
}
Expand Down

0 comments on commit 5436bb7

Please sign in to comment.