geoserver-cloud
geoserver-cloud copied to clipboard
wms's LegendSampleImpl.clean() fix
org.geoserver.wms.capabilities.LegendSampleImpl.clean()
, called by the constructor:
private void clean() {
for (StyleInfo style : catalog.getStyles()) {
synchronized (style) {
Resource styleResource = getStyleResource(style);
Resource sampleFile;
try {
// remove old samples
sampleFile = getSampleFile(style);
if (isStyleNewerThanSample(styleResource, sampleFile)) {
sampleFile.delete();
}
} catch (IOException e) {
LOGGER.log(
Level.SEVERE,
"Error cleaning invalid legend sample for " + style.getName(),
e);
}
}
}
invalidated = new HashSet<String>();
}
- there's no point in synchronizing on the
StyleInfo
, you get a new one on each call, lock thestyleResource
instead -
if (isStyleNewerThanSample(styleResource, sampleFile))
tries to deletesampleFile
even if it doesn't exist