Skip to content

Put missing properties JdbcDatabaseContainer.createConnection#11371

Closed
ebyhr wants to merge 1 commit intotestcontainers:mainfrom
ebyhr:ebi/jdbc
Closed

Put missing properties JdbcDatabaseContainer.createConnection#11371
ebyhr wants to merge 1 commit intotestcontainers:mainfrom
ebyhr:ebi/jdbc

Conversation

@ebyhr
Copy link
Copy Markdown

@ebyhr ebyhr commented Dec 23, 2025

The existing Properties constructor at L266 creates an empty property list. We should explicitly call putAll method.

@ebyhr ebyhr requested a review from a team as a code owner December 23, 2025 08:43
Properties properties = new Properties(info);
properties.put("user", this.getUsername());
properties.put("password", this.getPassword());
properties.putAll(info);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It makes little sense to have the properties constructed with info if we already add all its properties.

Properties properties = new Properties(info);
properties.put("user", this.getUsername());
properties.put("password", this.getPassword());
properties.putAll(info);
Copy link
Copy Markdown

@findinpath findinpath Dec 23, 2025

Choose a reason for hiding this comment

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

fix makes sense

public class TestProperties
{
    public static void main(String[] args)
    {
        Properties properties = new Properties();
        properties.setProperty("key1", "value1");
        properties.setProperty("key2", "value2");
        properties.forEach((k, v) -> System.out.println(k + ": " + v));

        System.out.println("--- After Copy ---");

        Properties newProperties  = new Properties(properties);
        newProperties.forEach((k, v) -> System.out.println(k + ": " + v));


        System.out.println("--- Defaults ---");
        System.out.println(newProperties.getProperty("key1"));
        System.out.println(newProperties.getProperty("unknown"));

    }
}

@ebyhr
Copy link
Copy Markdown
Author

ebyhr commented Mar 24, 2026

Closing due to no review activity for a few months.

@ebyhr ebyhr closed this Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants