Skip to content

Commit

Permalink
ResourcePools sldCache bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarsballe committed Aug 25, 2017
1 parent 0d2eb5d commit 5a95335
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/src/main/java/org/geoserver/catalog/ResourcePool.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
import org.geotools.measure.Measure; import org.geotools.measure.Measure;
import org.geotools.referencing.CRS; import org.geotools.referencing.CRS;
import org.geotools.styling.Style; import org.geotools.styling.Style;
import org.geotools.styling.StyleImpl;
import org.geotools.styling.StyledLayerDescriptor; import org.geotools.styling.StyledLayerDescriptor;
import org.geotools.util.SoftValueHashMap; import org.geotools.util.SoftValueHashMap;
import org.geotools.util.Utilities; import org.geotools.util.Utilities;
Expand Down Expand Up @@ -368,8 +369,8 @@ protected Map<CoverageHintReaderKey, GridCoverageReader> createHintCoverageReade
* The concrete Map implementation is determined by {@link #createSldCache()} * The concrete Map implementation is determined by {@link #createSldCache()}
* </p> * </p>
*/ */
public Map<StyleInfo, Style> getSldCache() { public Map<StyleInfo, StyledLayerDescriptor> getSldCache() {
return styleCache; return sldCache;
} }


protected Map<StyleInfo, StyledLayerDescriptor> createSldCache() { protected Map<StyleInfo, StyledLayerDescriptor> createSldCache() {
Expand Down Expand Up @@ -1990,18 +1991,16 @@ public Style getStyle( final StyleInfo info ) throws IOException {
synchronized (styleCache) { synchronized (styleCache) {
style = styleCache.get( info ); style = styleCache.get( info );
if ( style == null ) { if ( style == null ) {
//TODO: Do we want to be caching the SLD, or not here?
/*
style = dataDir().parsedStyle(info); style = dataDir().parsedStyle(info);
*/
StyledLayerDescriptor sld = getSld(info);
style = Styles.style(sld);


if (style == null) { if (style == null) {
throw new ServiceException("Could not extract a UserStyle definition from " throw new ServiceException("Could not extract a UserStyle definition from "
+ info.getName()); + info.getName());
} }

//Make sure we don't change the name of an object in sldCache
if (style instanceof StyleImpl) {
style = (Style)((StyleImpl)style).clone();
}
// remove this when wms works off style info // remove this when wms works off style info
style.setName( info.getName() ); style.setName( info.getName() );
styleCache.put( info, style ); styleCache.put( info, style );
Expand Down

0 comments on commit 5a95335

Please sign in to comment.