cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject svn commit: r292770 - in /cocoon/trunk/src/java/org/apache/cocoon/i18n: XMLResourceBundleFactory.java XMLResourceBundleNotFoundException.java
Date Fri, 30 Sep 2005 15:29:18 GMT
Author: bloritsch
Date: Fri Sep 30 08:29:15 2005
New Revision: 292770

URL: http://svn.apache.org/viewcvs?rev=292770&view=rev
Log:
update XMLResourceBundle, and hopefully avoid a possible memory leak

Added:
    cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleNotFoundException.java
Modified:
    cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java

Modified: cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java?rev=292770&r1=292769&r2=292770&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleFactory.java Fri Sep 30
08:29:15 2005
@@ -22,7 +22,6 @@
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
@@ -371,10 +370,11 @@
     protected String getFileName(String base, String name, Locale locale) {
         StringBuffer sb = new StringBuffer();
         if (base == null || base.length() == 0) {
-            // FIXME (SW): can this happen?
+            throw new IllegalArgumentException("'base' cannot be empty or null.");
         } else {
+	    Source src = null;
             try {
-                Source src = this.resolver.resolveURI(base);
+                src = this.resolver.resolveURI(base);
                 String uri = src.getURI();
                 sb.append(uri);
                 if (!uri.endsWith("/")) {
@@ -382,7 +382,9 @@
                 }
                 this.resolver.release(src);
             } catch(IOException ioe) {
-                throw new CascadingRuntimeException("Cannot resolve " + base, ioe);
+                throw new XMLResourceBundleNotFoundException("Cannot resolve " + base, ioe);
+            } finally {
+                this.resolver.release(src);
             }
         }
 

Added: cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleNotFoundException.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleNotFoundException.java?rev=292770&view=auto
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleNotFoundException.java (added)
+++ cocoon/trunk/src/java/org/apache/cocoon/i18n/XMLResourceBundleNotFoundException.java Fri
Sep 30 08:29:15 2005
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.i18n;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+
+public final class XMLResourceBundleNotFoundException extends CascadingRuntimeException
+{
+    public XMLResourceBundleNotFoundException(String message)
+    {
+        super(message, null);
+    }
+
+    public XMLResourceBundleNotFoundException(String message, Throwable cause)
+    {
+        super(message, cause);
+    }
+}



Mime
View raw message