portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r918448 - /portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java
Date Wed, 03 Mar 2010 12:42:03 GMT
Author: woonsan
Date: Wed Mar  3 12:42:02 2010
New Revision: 918448

URL: http://svn.apache.org/viewvc?rev=918448&view=rev
Log:
JS2-1094: Using file input stream if possible because classloader#getResourceAsStream() returns
a cached one in tomcat.

Modified:
    portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java

Modified: portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java?rev=918448&r1=918447&r2=918448&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-commons/src/main/java/org/apache/jetspeed/util/ReloadablePropertyResourceBundle.java
Wed Mar  3 12:42:02 2010
@@ -17,8 +17,12 @@
 package org.apache.jetspeed.util;
 
 import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Properties;
@@ -75,7 +79,17 @@
         
         try
         {
-            is = loader.getResourceAsStream(resPath);
+            URL url = loader.getResource(resPath);
+            
+            if ("file".equals(url.getProtocol()))
+            {
+                is = new FileInputStream(new File(url.toURI()));
+            }
+            else
+            {
+                is = url.openStream();
+            }
+            
             bis = new BufferedInputStream(is);
             props.load(bis);
             
@@ -84,6 +98,10 @@
                 overridingProps = props;
             }
         }
+        catch (URISyntaxException e)
+        {
+            throw new IOException(e.toString());
+        }
         finally
         {
             if (bis != null)



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message