Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.2.7
-
Fix Version/s: 0.2.8
-
Component/s: None
-
Labels:None
Description
When SmartSprites run in Windows system, it throws this exception:
---------------------------------------------------
INFO: Initializing Spring FrameworkServlet 'spring'
Jan 24, 2011 9:49:25 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet / threw load() exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at org.carrot2.labs.smartsprites.SpriteBuilder.createProcessedCss(SpriteBuilder.java:327)
at org.carrot2.labs.smartsprites.SpriteBuilder.rewriteCssFiles(SpriteBuilder.java:260)
at org.carrot2.labs.smartsprites.SpriteBuilder.buildSprites(SpriteBuilder.java:211)
...
---------------------------------------------------
I think the problem is on this part of the code:
"originalCssFile.lastIndexOf(File.separatorChar)"
The css file is using the forward slash "/", but when the SmartSprites runs in Windows, it will try to look for "\", which is not found!
/** sprite: iconSprite; sprite-image: url('../../../img/bg_sprite_icons.png'); sprite-layout: vertical; */
Thanks for the report! The bug was cause by the lack of clear contract on the SpriteBuilder.buildSprites(Collection<String> files) method. Previously, the method would work only with platform-specific path separator, now it also accepts '/' as the separator, even if the platform-specific character is different.
When you have a sec, please check if version 0.2.8-dev fixes your issue. If you don't discover any other problems, I'll release 0.2.8 with this fix.