Skip to content
Open
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
2 changes: 2 additions & 0 deletions portability-types-transfer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ dependencies {
annotationProcessor "com.google.auto.value:auto-value:${autoValueVersion}"

compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}")

compile('org.apache.commons:commons-lang3:3.11')

testCompile("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
testCompile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.datatransferproject.types.transfer.retry;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.exception.ExceptionUtils;
import java.util.Arrays;

/**
Expand Down Expand Up @@ -48,13 +49,18 @@ public RetryStrategy getStrategy() {
}

public boolean matchesThrowable(Throwable throwable) {
// TODO: examine entire throwable, not just toString
String input = throwable.toString();
for (String regex : regexes) {
if (input.matches(regex)) {
return true;
}
}
Copy link
Collaborator

@jzacsh jzacsh Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does leaving the previous loop seem like a micro-optimization? should we just delete it for now and add something like this (or something else) in later, if we do performance testing and find this area problematic?

EDIT: I see the loop before is actually probably very different (first loop vs. second loop). so maybe just add a comment block atop both loops explaining (eg: // try to match on throwable's faster-to-compute string and // see if maybe the fuller stacktrace reveals any matches)?

String stacktrace = ExceptionUtils.getStackTrace(throwable);
for (String regex : regexes) {
if (stacktrace.matches(regex)) {
return true;
}
}
return false;
}

Expand Down