[Geoserver-devel] Issues saving styles

Hi,
saving and reloading styles I noticed quite a weird behavior.

A properly saved style looks like:

<style>
   <id>StyleInfoImpl--3c5d7bd0:123272e08af:-8000</id>
   <name>roads_classified</name>
   <filename>roads_classified.sld</filename>
</style>

However, I have a few style xml files containing:

<dynamic-proxy>
   <interface>style</interface>
   <handler class="org.geoserver.catalog.impl.ModificationProxy">
     <proxyObject class="dynamic-proxy">
       <interface>style</interface>
       <handler class="org.geoserver.catalog.impl.ModificationProxy">
         <proxyObject class="dynamic-proxy">
           <interface>style</interface>
           <handler class="org.geoserver.catalog.impl.ModificationProxy">
             <proxyObject class="dynamic-proxy">
               <interface>style</interface>
               <handler class="org.geoserver.catalog.impl.ModificationProxy">
                 <proxyObject class="dynamic-proxy">
                   <interface>style</interface>
                   <handler class="org.geoserver.catalog.impl.ModificationProxy">
                     <proxyObject class="style">
                       <id>StyleInfoImpl--2fb2b38c:12327ece3b0:-8000</id>
                       <name>roads_classified_labels</name>
                       <filename>roads_classified_labels.sld</filename>
                     </proxyObject>
                   </handler>
                 </proxyObject>
               </handler>
             </proxyObject>
           </handler>
         </proxyObject>
       </handler>
     </proxyObject>
   </handler>
</dynamic-proxy>

This does not reload properly, but besides that, imho the code
should prevent dynamic proxies to be saved to start with:
- the catalog level should unpack the proxies (and make sure
   there are no proxies of proxies around)
- the persistence level should simply refuse to save proxies
   so that we can catch this bugs earlier

Opinions?
Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Hi,
saving and reloading styles I noticed quite a weird behavior.

A properly saved style looks like:

<style>
   <id>StyleInfoImpl--3c5d7bd0:123272e08af:-8000</id>
   <name>roads_classified</name>
   <filename>roads_classified.sld</filename>
</style>

However, I have a few style xml files containing:

<dynamic-proxy>
   <interface>style</interface>
   <handler class="org.geoserver.catalog.impl.ModificationProxy">
     <proxyObject class="dynamic-proxy">
       <interface>style</interface>
       <handler class="org.geoserver.catalog.impl.ModificationProxy">
         <proxyObject class="dynamic-proxy">
           <interface>style</interface>
           <handler class="org.geoserver.catalog.impl.ModificationProxy">
             <proxyObject class="dynamic-proxy">
               <interface>style</interface>
               <handler class="org.geoserver.catalog.impl.ModificationProxy">
                 <proxyObject class="dynamic-proxy">
                   <interface>style</interface>
                   <handler class="org.geoserver.catalog.impl.ModificationProxy">
                     <proxyObject class="style">
                       <id>StyleInfoImpl--2fb2b38c:12327ece3b0:-8000</id>
                       <name>roads_classified_labels</name>
                       <filename>roads_classified_labels.sld</filename>
                     </proxyObject>
                   </handler>
                 </proxyObject>
               </handler>
             </proxyObject>
           </handler>
         </proxyObject>
       </handler>
     </proxyObject>
   </handler>
</dynamic-proxy>

This does not reload properly, but besides that, imho the code
should prevent dynamic proxies to be saved to start with:
- the catalog level should unpack the proxies (and make sure
   there are no proxies of proxies around)

Agreed, and it does in most cases. I am guessing that somewhere an unwrap() is not being called for styles.

- the persistence level should simply refuse to save proxies
   so that we can catch this bugs earlier

Well any call to save explicitly tries to unwrap all proxies. But a check right after that for if the instance is still a proxy is a good idea.

Opinions?
Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.