Skip to content

Commit 96acaf0

Browse files
authored
Catch and ignore more errors when reflecting into container subclass (#5990)
With #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.
1 parent 2da2675 commit 96acaf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/testcontainers/containers/GenericContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ protected boolean canBeReused() {
360360
logger().warn("{} can't be reused because it overrides {}", getClass(), method.getName());
361361
return false;
362362
}
363-
} catch (NoSuchMethodException e) {
363+
} catch (NoSuchMethodException | NoClassDefFoundError e) {
364364
// ignore
365365
}
366366
}

0 commit comments

Comments
 (0)