incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r432396 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
Date Thu, 17 Aug 2006 21:38:28 GMT
Author: awiner
Date: Thu Aug 17 14:38:28 2006
New Revision: 432396

URL: http://svn.apache.org/viewvc?rev=432396&view=rev
Log:
Fix recently introduced bug where url() properties using single or double quotes were not
processed correctly

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java?rev=432396&r1=432395&r2=432396&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
Thu Aug 17 14:38:28 2006
@@ -432,7 +432,21 @@
       
       endIndex = url.indexOf(')', index + 3);
       String uri = url.substring(index + 4, endIndex);
-      if(uri.length() == 0)
+
+      // Trim off 
+      int uriLength = uri.length();
+      if (uriLength > 0)
+      {
+        if ((uri.charAt(0) == '\'' && uri.charAt(uriLength - 1) == '\'') ||
+            (uri.charAt(0) == '"' && uri.charAt(uriLength - 1) == '"'))
+        {
+          uri = uri.substring(1, uriLength - 1);
+          uriLength = uriLength - 2;
+        }
+      }
+
+
+      if(uriLength == 0)
       {
         // url() or url('') found, should not happen.
         _LOG.warning("An empty URL was found in selector '" +
@@ -444,11 +458,11 @@
       if(uri.charAt(0) == '/')
       {
         // A transformation is required
-        if(uri.length() > 1 && uri.charAt(1) == '/')
+        if(uriLength > 1 && uri.charAt(1) == '/')
         {
           // Double slashes, trim one and do not add context root before
           builder.append("url(");
-          builder.append(uri, 1, uri.length());
+          builder.append(uri, 1, uriLength);
           builder.append(')');
         }
         else
@@ -981,14 +995,14 @@
     }
 
     StringBuilder buffer = new StringBuilder(strippedBaseURI.length() +
-                                           strippedURI.length() +
-                                           6);
+                                             strippedURI.length() +
+                                             8);
 
-    buffer.append("url(");
+    buffer.append("url('");
     buffer.append(strippedBaseURI);
     buffer.append("/");
     buffer.append(strippedURI);
-    buffer.append(")");
+    buffer.append("')");
 
     return buffer.toString();
   }



Mime
View raw message