private String preprocessSLD(StyledLayerDescriptor sld){
  if (sld == null) {
    return null;
  }
  SLDWriterInterface sldWriter=SLDWriterFactory.createWriter(null);
  DuplicatingStyleVisitor duplicator=new DuplicatingStyleVisitor();
  sld.accept(duplicator);
  StyledLayerDescriptor sldCopy=(StyledLayerDescriptor)duplicator.getCopy();
  for (  StyledLayer styledLayer : sldCopy.layers()) {
    if (styledLayer instanceof UserLayer) {
      UserLayerImpl userLayer=(UserLayerImpl)styledLayer;
      userLayer.setInlineFeatureDatastore(null);
      userLayer.setInlineFeatureType(null);
    }
  }
  String sldContents=sldWriter.encodeSLD(null,sldCopy);
  return sldContents;
}

private String preprocessSLD ( StyledLayerDescriptor sld ) { if ( sld == null ) { return null ; } SLDWriterInterface sldWriter = SLDWriterFactory . createWriter ( null ) ; DuplicatingStyleVisitor duplicator = new DuplicatingStyleVisitor ( ) ; sld . accept ( duplicator ) ; StyledLayerDescriptor sldCopy = ( StyledLayerDescriptor ) duplicator . getCopy ( ) ; for ( StyledLayer styledLayer : sldCopy . layers ( ) ) { if ( styledLayer instanceof UserLayer ) { UserLayerImpl userLayer = ( UserLayerImpl ) styledLayer ; userLayer . setInlineFeatureDatastore ( null ) ; userLayer . setInlineFeatureType ( null ) ; } } String sldContents = sldWriter . encodeSLD ( null , sldCopy ) ; return sldContents ; }
take a copy of the styledlayerdescriptor and null out the inline features
