You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@hyperreal.org on 1999/11/10 05:23:47 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/security/file FileRealmConnector.java
craigmcc 99/11/09 20:23:46
Modified: src/share/org/apache/tomcat/security/file
FileRealmConnector.java
Log:
Factor out the multiple calls to close the stream into a "finally" block.
Thanks to Preston Bannister <pr...@home.com> for the suggested change.
Revision Changes Path
1.4 +7 -21 jakarta-tomcat/src/share/org/apache/tomcat/security/file/FileRealmConnector.java
Index: FileRealmConnector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/security/file/FileRealmConnector.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileRealmConnector.java 1999/10/29 06:14:41 1.3
+++ FileRealmConnector.java 1999/11/10 04:23:44 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/security/file/FileRealmConnector.java,v 1.3 1999/10/29 06:14:41 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 1999/10/29 06:14:41 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/security/file/FileRealmConnector.java,v 1.4 1999/11/10 04:23:44 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 1999/11/10 04:23:44 $
*
* ====================================================================
*
@@ -83,7 +83,7 @@
* XML-stored database of users and their associated roles.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 1999/10/29 06:14:41 $
+ * @version $Revision: 1.4 $ $Date: 1999/11/10 04:23:44 $
*/
public final class FileRealmConnector
@@ -230,34 +230,20 @@
try {
this.database = new FileRealmDatabase(stream);
} catch (IOException e) {
- try {
- stream.close();
- } catch (IOException f) {
- ;
- }
throw new IllegalArgumentException(
sm.getString("file.start.read", filename) + ": " + e);
} catch (SAXParseException e) {
- try {
- stream.close();
- } catch (IOException f) {
- ;
- }
throw new IllegalArgumentException(
sm.getString("file.start.parse", filename) + ": " + e);
} catch (SAXException e) {
+ throw new IllegalArgumentException(
+ sm.getString("file.start.process", filename) + ": " + e);
+ } finally {
try {
stream.close();
} catch (IOException f) {
;
}
- throw new IllegalArgumentException(
- sm.getString("file.start.process", filename) + ": " + e);
- }
- try {
- stream.close();
- } catch (IOException e) {
- ;
}
// Store a local reference to our associated context