Skip to content

Commit

Permalink
Merge pull request #1525 from akto-api-security/feature/bloom_filter_…
Browse files Browse the repository at this point in the history
…for_dict

fix: overriding hashcode and equal in MergedUrls class
  • Loading branch information
avneesh-akto authored Sep 20, 2024
2 parents 33e43d9 + 6963be0 commit 97af1ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libs/dao/src/main/java/com/akto/dto/filter/MergedUrls.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.bson.types.ObjectId;

import java.util.Objects;

public class MergedUrls {
private ObjectId id;

Expand All @@ -22,6 +24,19 @@ public MergedUrls(String url, String method, int apiCollectionId) {
this.apiCollectionId = apiCollectionId;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MergedUrls that = (MergedUrls) o;
return apiCollectionId == that.apiCollectionId && Objects.equals(url, that.url) && Objects.equals(method, that.method);
}

@Override
public int hashCode() {
return Objects.hash(url, method, apiCollectionId);
}

public ObjectId getId() {
return id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static boolean isEnglishWord(String word) {
return dictFilter.mightContain(word);
}

// Return false if any non-empty word in the array is not contained in the dictionary.
private static boolean wordsChecker(String[] words) {
for(String seg : words) {
if(!seg.isEmpty() && !dictFilter.mightContain(seg.toUpperCase())) return false;
Expand Down

0 comments on commit 97af1ce

Please sign in to comment.