[richfaces-svn-commits] JBoss Rich Faces SVN: r5886 - in branches/3.1.x/framework/impl/src/main/java/org: ajax4jsf/resource/util and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Feb 6 19:29:13 EST 2008


Author: nbelaevski
Date: 2008-02-06 19:29:13 -0500 (Wed, 06 Feb 2008)
New Revision: 5886

Added:
   branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/
   branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
Removed:
   branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
Modified:
   branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
   branches/3.1.x/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
Log:
http://jira.jboss.com/jira/browse/RF-1284

Modified: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java	2008-02-07 00:21:32 UTC (rev 5885)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/ResourceBuilderImpl.java	2008-02-07 00:29:13 UTC (rev 5886)
@@ -47,10 +47,7 @@
 import javax.servlet.ServletContext;
 
 import org.ajax4jsf.Messages;
-import org.ajax4jsf.resource.InternetResource;
-import org.ajax4jsf.resource.InternetResourceBuilder;
-import org.ajax4jsf.resource.ResourceNotFoundException;
-import org.ajax4jsf.resource.ResourceRenderer;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
 import org.ajax4jsf.util.base64.Codec;
 import org.ajax4jsf.webapp.WebXml;
 import org.apache.commons.digester.Digester;
@@ -154,7 +151,7 @@
 						+ resourceConfig.toExternalForm());
 			}
 
-			InputStream in = resourceConfig.openStream();
+			InputStream in = URLToStreamHelper.urlToStream(resourceConfig);
 			try {
 				Digester digester = new Digester();
 				digester.setValidating(false);

Copied: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util (from rev 5885, trunk/framework/impl/src/main/java/org/ajax4jsf/resource/util)

Deleted: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java	2008-02-07 00:21:32 UTC (rev 5885)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java	2008-02-07 00:29:13 UTC (rev 5886)
@@ -1,59 +0,0 @@
-/**
- * License Agreement.
- *
- *  JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007  Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
- */
-
-package org.ajax4jsf.resource.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Utility class to solve JAR locking issue using {@link URLConnection#setUseCaches(boolean)} method.
- * Contains one utility method that gets {@link InputStream} from {@link URL} with caching disabled.
- * 
- * Created 07.02.2008
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public final class URLToStreamHelper {
-
-	private static final Log log = LogFactory.getLog(URLToStreamHelper.class);
-	
-	private URLToStreamHelper() {
-		super();
-	}
-	
-	public static final InputStream urlToStream(URL url) throws IOException {
-		URLConnection connection = url.openConnection();
-		try {
-			connection.setUseCaches(false);
-		} catch (IllegalArgumentException e) {
-			log.error(e.getLocalizedMessage(), e);
-		}
-
-		return connection.getInputStream();
-	}
-}

Copied: branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java (from rev 5885, trunk/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java)
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java	                        (rev 0)
+++ branches/3.1.x/framework/impl/src/main/java/org/ajax4jsf/resource/util/URLToStreamHelper.java	2008-02-07 00:29:13 UTC (rev 5886)
@@ -0,0 +1,59 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007  Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+package org.ajax4jsf.resource.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Utility class to solve JAR locking issue using {@link URLConnection#setUseCaches(boolean)} method.
+ * Contains one utility method that gets {@link InputStream} from {@link URL} with caching disabled.
+ * 
+ * Created 07.02.2008
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public final class URLToStreamHelper {
+
+	private static final Log log = LogFactory.getLog(URLToStreamHelper.class);
+	
+	private URLToStreamHelper() {
+		super();
+	}
+	
+	public static final InputStream urlToStream(URL url) throws IOException {
+		URLConnection connection = url.openConnection();
+		try {
+			connection.setUseCaches(false);
+		} catch (IllegalArgumentException e) {
+			log.error(e.getLocalizedMessage(), e);
+		}
+
+		return connection.getInputStream();
+	}
+}

Modified: branches/3.1.x/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
--- branches/3.1.x/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java	2008-02-07 00:21:32 UTC (rev 5885)
+++ branches/3.1.x/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java	2008-02-07 00:29:13 UTC (rev 5886)
@@ -39,12 +39,10 @@
 import javax.faces.el.ValueBinding;
 
 import org.ajax4jsf.Messages;
+import org.ajax4jsf.resource.util.URLToStreamHelper;
 import org.ajax4jsf.util.ELUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-import org.richfaces.skin.SkinNotFoundException;
 
 /**
  * Implementation of {@link SkinFactory} with building skins from properties
@@ -159,7 +157,7 @@
 				URL url = (URL) properties.nextElement();
 				InputStream propertyStream = null;
 				try {
-					propertyStream = url.openStream();
+					propertyStream = URLToStreamHelper.urlToStream(url);
 					defaultProperties.load(propertyStream);
 				} catch (IOException e) {
 					// DO Nothing...
@@ -294,7 +292,7 @@
 					URL url = (URL) properties.nextElement();
 					InputStream propertyStream = null;
 					try {
-						propertyStream = url.openStream();
+						propertyStream = URLToStreamHelper.urlToStream(url);
 						skinProperties.load(propertyStream);
 						loadedPropertiesCount++;
 					} catch (IOException e) {




More information about the richfaces-svn-commits mailing list