java.lang.ClassCastException throwed by 
org.geoserver.config.util.XStreamPersister while saving a layer with 
"java.lang.Short" bondary values
---------------------------------------------------------------------------------------------------------------------------------------------

                 Key: GEOS-3701
                 URL: http://jira.codehaus.org/browse/GEOS-3701
             Project: GeoServer
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 2.0.0
         Environment: Windows Vista x64. Sun Java Development Kit 1.6.0 Update 
16 32 bits + JAI for Windows x86 32 bits + JBoss Application Server 4.2.3. 
Geoserver 2.0.0 Web War Version. 
            Reporter: Rodolfo Rothganger
            Assignee: Justin Deoliveira
             Fix For: 2.0.1


While tring to register a layer mapped to a GeoTopp 30 data store (bounded to 
-60, -60, -20, -10)   with SRS EPSG:4326), the following error is generated:

java.lang.ClassException: cannot convert java.lang.Short to java.lang.Double 


I´ve mapped the problem to the following lines of codes on class 
"org.geoserver.config.util.XStreamPersister" (lines 957 to 972):

             if ( Double.isInfinite( 
((Double)range.getMinValue()).doubleValue() ) ) {
                context.convertAnother( "-inf" );
            }
            else {
                context.convertAnother( range.getMinValue() );  
            }
            writer.endNode();
            
            writer.startNode("max");
            if ( Double.isInfinite( ((Double)range.getMaxValue()).doubleValue() 
)) {
                context.convertAnother( "inf");
            }
            else {
                context.convertAnother( range.getMaxValue() );  
            }
            writer.endNode();


Fixed the problem with the code change bellow:

  if ( Double.isInfinite( ((Number)range.getMinValue()).doubleValue() ) ) {
                context.convertAnother( "-inf" );
            }
            else {
                context.convertAnother( range.getMinValue() );  
            }
            writer.endNode();
            
            writer.startNode("max");
            if ( Double.isInfinite( ((Number)range.getMaxValue()).doubleValue() 
)) {
                context.convertAnother( "inf");
            }
            else {
                context.convertAnother( range.getMaxValue() );  
            }
            writer.endNode();


Although the change worked, I am not sure that is the best fix. I believe 
somechanges related to the use of Generics on the class NumberRange (and not 
the raw type) would solve the problem. Perhaps on line 954, something like: 
NumberRange<? extends Number> range = NumberRange(? extends Number) original.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to