flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ssaumitra <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2827] Closing FileInputStream in finall...
Date Tue, 20 Oct 2015 17:35:30 GMT
Github user ssaumitra commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1276#discussion_r42527314
  
    --- Diff: flink-staging/flink-streaming/flink-streaming-connectors/flink-connector-twitter/src/main/java/org/apache/flink/streaming/connectors/twitter/TwitterSource.java
---
    @@ -133,13 +134,21 @@ protected OAuth1 authenticate() {
     	private Properties loadAuthenticationProperties() {
     		
     		Properties properties = new Properties();
    +		InputStream input = null;
     		try {
    -			InputStream input = new FileInputStream(authPath);
    +			input = new FileInputStream(authPath);
     			properties.load(input);
    -			input.close();
     		} catch (Exception e) {
     			throw new RuntimeException("Cannot open .properties file: " + authPath, e);
     		}
    +		finally {
    +			try {
    --- End diff --
    
    This try..catch does not look beautiful. But `input.close()` mandates it. Also `close()`
will not be called if `FileInputStream` is not open.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message