Skip to content

Fix incorrectly added functions. #4317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,8 @@ public void write(Chunk<? extends String> chunk) throws Exception {
assertEquals("Expected Exception!", exception.getMessage());
// retry exhausted, now scanning
processor.process(contribution, inputs);
// skip on this attempt
exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
assertEquals("Expected Exception!", exception.getMessage());
// 2nd exception detected
exception = assertThrows(RuntimeException.class, () -> processor.process(contribution, inputs));
assertEquals("Expected Exception!", exception.getMessage());
// still scanning
processor.process(contribution, inputs);
assertEquals(2, contribution.getSkipCount());
assertEquals(2, contribution.getWriteCount());

assertEquals(1, contribution.getWriteCount());
assertEquals(0, contribution.getFilterCount());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,32 @@ public String toString() {
return String.format("[items=%s, skips=%s]", items, skips);
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof Chunk)) {
return false;
}
Chunk<?> other = (Chunk<?>) obj;
return Objects.equals(this.items, other.items) && Objects.equals(this.skips, other.skips)
&& Objects.equals(this.errors, other.errors) && Objects.equals(this.userData, other.userData)
&& this.end == other.end && this.busy == other.busy;
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + items.hashCode();
result = 31 * result + skips.hashCode();
result = 31 * result + errors.hashCode();
result = 31 * result + Objects.hashCode(userData);
result = 31 * result + (end ? 1 : 0);
result = 31 * result + (busy ? 1 : 0);
return result;
}

/**
* Special iterator for a chunk providing the {@link #remove(Throwable)} method for
* dynamically removing an item and adding it to the skips.
Expand Down Expand Up @@ -262,25 +288,6 @@ public String toString() {
return String.format("[items=%s, skips=%s]", items, skips);
}

@Override
public int hashCode() {
return Objects.hash(items, skips, errors, userData, end, busy);
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Chunk)) {
return false;
}
Chunk<?> other = (Chunk<?>) obj;
return Objects.equals(items, other.items) && Objects.equals(skips, other.skips)
&& Objects.equals(errors, other.errors) && Objects.equals(userData, other.userData)
&& end == other.end && busy == other.busy;
}

}

}