My favorites
▼
|
Sign in
jmesa
Table Rendering API
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
203
attachment: Close_streams_in_finally_block.patch
(2.4 KB)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Index: src/org/jmesa/core/preference/PropertiesPreferences.java
===================================================================
--- src/org/jmesa/core/preference/PropertiesPreferences.java (revision 2338)
+++ src/org/jmesa/core/preference/PropertiesPreferences.java Mon Jul 27 19:29:00 BST 2009
@@ -31,7 +31,7 @@
* @author Jeff Johnston
*/
public final class PropertiesPreferences implements Preferences {
- private Logger logger = LoggerFactory.getLogger(PropertiesPreferences.class);
+ private final Logger logger = LoggerFactory.getLogger(PropertiesPreferences.class);
private static final String JMESA_PROPERTIES = "jmesa.properties";
@@ -40,15 +40,29 @@
public PropertiesPreferences(String preferencesLocation, WebContext webContext) {
try {
InputStream resourceAsStream = getInputStream(JMESA_PROPERTIES, webContext);
+ try {
- properties.load(resourceAsStream);
+ properties.load(resourceAsStream);
+ } finally {
+ try {
- resourceAsStream.close();
+ resourceAsStream.close();
+ } catch (IOException e) {
+ logger.error("Could not close the JMesa default preferences.", e);
+ }
+ }
if (StringUtils.isNotBlank(preferencesLocation)) {
InputStream input = getInputStream(preferencesLocation, webContext);
if (input != null) {
+ try {
- properties.load(input);
+ properties.load(input);
+ } finally {
+ try {
- input.close();
+ input.close();
+ } catch (IOException e) {
+ logger.error("Could not close the JMesa preferences.", e);
- }
- }
+ }
+ }
+ }
+ }
} catch (IOException e) {
logger.error("Could not load the JMesa preferences.", e);
}
@@ -73,6 +87,6 @@
public String toString() {
ToStringBuilder builder = new ToStringBuilder(this);
builder.append("properties", properties);
- return builder.toString();
+ return builder.toString();
}
}
Powered by
Google Project Hosting