changcheng / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

CSSMin.parseProperties doesn't check for empty property #476

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In current dev version v1.4.7-SNAPSHOT

with standard wro4j.properties
managerFactoryClassName=ro.isdc.wro.manager.factory.ConfigurableWroManagerFactor
y
preProcessors=cssUrlRewriting,cssImport,semicolonAppender,cssMin
postProcessors=cssVariables,jsMin

having css:

#home {
  min-height: 100%;        /* real browsers */
}

I'm getting 

09:28:21,245  WARN CSSMin:125 - Warning: Incomplete property:    
java.lang.Exception: Warning: Incomplete property:    
    at ro.isdc.wro.model.resource.processor.support.Property.<init>(CSSMin.java:159)
    at ro.isdc.wro.model.resource.processor.support.Selector.parseProperties(CSSMin.java:123)

This is cased by incorrect split behaviour
final String[] parts = contents.split(";");
which results in 2 parts:
 min-height: 100%
and empty one '   '.

Solution:
Check for empty parts[i] and don't pass it to new Property(parts[i]);
Or better use guava's:
Splitter.on(';').omitEmptyStrings().trimResults();

http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Sp
litter.html

Original issue reported on code.google.com by o...@omax.org.ua on 29 Jun 2012 at 6:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Although this is just warning (with stacktrace), to workaround for this just 
remove any trailing comments:
#home {
  min-height: 100%;
}

Original comment by o...@omax.org.ua on 29 Jun 2012 at 6:39

GoogleCodeExporter commented 9 years ago
Thanks, will fix this soon.

Original comment by alex.obj...@gmail.com on 29 Jun 2012 at 7:06

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 29 Jun 2012 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by alex.obj...@gmail.com on 29 Jun 2012 at 11:04