Skip to content

Change to use try-with-resources on test #1270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2018

Conversation

kazuki43zoo
Copy link
Member

@kazuki43zoo kazuki43zoo commented May 3, 2018

In current implementation, close a external resource explicitly.

Before:
e.g.

Connection connection = ....;
try {
    // ...
} finally {
    connection.close();
}

or

Reader reader = ....;
// ...
reader.close();  // If an exception is occurred, there is possible that an external resource does not close 

I've modified to use the try-with-resources supported by JDK 7 as follow:

After:

try (Connection connection = ....) {
    // ...
}

@kazuki43zoo kazuki43zoo merged commit d5f024c into mybatis:master May 3, 2018
@kazuki43zoo kazuki43zoo deleted the try-with-resources branch May 3, 2018 13:34
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Change to use try-with-resources on test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant