You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2005/12/31 23:46:25 UTC
svn commit: r360457 -
/cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java
Author: antonio
Date: Sat Dec 31 14:46:22 2005
New Revision: 360457
URL: http://svn.apache.org/viewcvs?rev=360457&view=rev
Log:
Close streams.
Modified:
cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java
Modified: cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java?rev=360457&r1=360456&r2=360457&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/generation/XPathDirectoryGenerator.java Sat Dec 31 14:46:22 2005
@@ -318,7 +318,7 @@
}
/**
- * The MappingInfo class to reolve namespace prefixes to their namespace URI
+ * The MappingInfo class to resolve namespace prefixes to their namespace URI
*
* @version $Id$
*/
@@ -352,17 +352,29 @@
this.mappingSource = mappingSource;
this.reload = reload;
prefixMap = new HashMap();
+ InputStreamReader input = null;
+ BufferedReader br = null;
- final BufferedReader br = new BufferedReader(new InputStreamReader(mappingSource.getInputStream()));
-
- for (String line = br.readLine(); line != null; line = br.readLine()) {
- final int i = line.indexOf('=');
-
- if (i > 0) {
- final String prefix = line.substring(0, i);
- final String namespace = line.substring(i + 1);
- prefixMap.put(prefix, namespace);
- logger.debug("added mapping: '" + prefix + "'='" + namespace + "'");
+ try {
+ input = new InputStreamReader(mappingSource.getInputStream());
+ br = new BufferedReader(input);
+
+ for (String line = br.readLine(); line != null; line = br.readLine()) {
+ final int i = line.indexOf('=');
+
+ if (i > 0) {
+ final String prefix = line.substring(0, i);
+ final String namespace = line.substring(i + 1);
+ prefixMap.put(prefix, namespace);
+ logger.debug("added mapping: '" + prefix + "'='" + namespace + "'");
+ }
+ }
+ } finally {
+ if (br != null) {
+ br.close();
+ }
+ if (input != null) {
+ input.close();
}
}
}