Skip to content

Commit 63c6279

Browse files
committed
Polish
1 parent a16125d commit 63c6279

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/cassandra/src/main/java/org/testcontainers/cassandra/CassandraContainer.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,25 @@ protected void containerIsStarted(InspectContainerResponse containerInfo) {
7979
* Load init script content and apply it to the database if initScriptPath is set
8080
*/
8181
private void runInitScriptIfRequired() {
82-
if (initScriptPath != null) {
82+
if (this.initScriptPath != null) {
8383
try {
84-
final MountableFile originalInitScript = MountableFile.forClasspathResource(initScriptPath);
84+
final MountableFile originalInitScript = MountableFile.forClasspathResource(this.initScriptPath);
8585
// The init script is executed as is by the cqlsh command, so copy it into the container. The name
8686
// of the script is generic since it's not important to keep the original name.
8787
copyFileToContainer(originalInitScript, DEFAULT_INIT_SCRIPT_FILENAME);
8888
new CassandraDatabaseDelegate(this).execute(null, DEFAULT_INIT_SCRIPT_FILENAME, -1, false, false);
8989
} catch (IllegalArgumentException e) {
9090
// MountableFile.forClasspathResource will throw an IllegalArgumentException if the resource cannot
9191
// be found.
92-
logger().warn("Could not load classpath init script: {}", initScriptPath);
92+
logger().warn("Could not load classpath init script: {}", this.initScriptPath);
9393
throw new ScriptLoadException(
94-
"Could not load classpath init script: " + initScriptPath + ". Resource not found.", e);
94+
"Could not load classpath init script: " + this.initScriptPath + ". Resource not found.",
95+
e
96+
);
9597
} catch (ScriptUtils.ScriptStatementFailedException e) {
96-
logger().error("Error while executing init script: {}", initScriptPath, e);
98+
logger().error("Error while executing init script: {}", this.initScriptPath, e);
9799
throw new ScriptUtils.UncategorizedScriptException(
98-
"Error while executing init script: " + initScriptPath,
100+
"Error while executing init script: " + this.initScriptPath,
99101
e
100102
);
101103
}

0 commit comments

Comments
 (0)