Skip to content

Commit

Permalink
Catch and ignore more errors when reflecting into container subclass
Browse files Browse the repository at this point in the history
With testcontainers#2830 we added support for 4.x of the Cassandra driver.
It was done in a way to allow a user to use either the 3.x
or 4.x driver while excluding the other one. However if
using 4.x and excluding 3.x, GenericContainer#canBeReused
throws an exception during reflection since the Cluster
class returned by CassandraContainer#getCluster is missing.

This PR works around that issue by catching and ignoring
the thrown NoClassDefFoundError.
  • Loading branch information
akhaku committed Oct 13, 2022
1 parent 2da2675 commit 5bf0bb3
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -360,7 +360,7 @@ protected boolean canBeReused() {
logger().warn("{} can't be reused because it overrides {}", getClass(), method.getName());
return false;
}
} catch (NoSuchMethodException e) {
} catch (NoSuchMethodException | NoClassDefFoundError e) {
// ignore
}
}
Expand Down

0 comments on commit 5bf0bb3

Please sign in to comment.