You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by dd...@apache.org on 2006/12/06 13:51:22 UTC
svn commit: r483061 -
/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java
Author: ddewolf
Date: Wed Dec 6 04:51:19 2006
New Revision: 483061
URL: http://svn.apache.org/viewvc?view=rev&rev=483061
Log:
Properly closing input stream in PropertiesSettings; WW-1541, Thank you Rickard Oberg
Modified:
struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java?view=diff&rev=483061&r1=483060&r2=483061
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java Wed Dec 6 04:51:19 2006
@@ -21,6 +21,7 @@
package org.apache.struts2.config;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.Properties;
@@ -63,10 +64,20 @@
settings = new LocatableProperties(new LocationImpl(null, settingsUrl.toString()));
// Load settings
+ InputStream in = null;
try {
- settings.load(settingsUrl.openStream());
+ in = settingsUrl.openStream();
+ settings.load(in);
} catch (IOException e) {
throw new StrutsException("Could not load " + name + ".properties:" + e, e);
+ } finally {
+ if(in != null) {
+ try {
+ in.close();
+ } catch(IOException io) {
+ LOG.warn("Unable to close input stream");
+ }
+ }
}
}
Re: svn commit: r483061 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java
Posted by "David H. DeWolf" <dd...@apache.org>.
Done.
Thanks
Antonio Petrelli wrote:
> ddewolf@apache.org ha scritto:
>> + try {
>> + in.close();
>> + } catch(IOException io) {
>> + LOG.warn("Unable to close input stream");
>> + }
>>
>
> Just a suggestion, put the exception in the LOG.warn instruction.
>
> Ciao
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: svn commit: r483061 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/PropertiesSettings.java
Posted by Antonio Petrelli <ap...@apache.org>.
ddewolf@apache.org ha scritto:
> + try {
> + in.close();
> + } catch(IOException io) {
> + LOG.warn("Unable to close input stream");
> + }
>
Just a suggestion, put the exception in the LOG.warn instruction.
Ciao
Antonio
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org