[Mapguide-trac] [mapguide-trac] #2150: DataPropertyDefinition.GetDataType is case sensitive

MapGuide Open Source trac_mapguide at osgeo.org
Tue Oct 16 01:48:20 PDT 2012


#2150: DataPropertyDefinition.GetDataType is case sensitive
-----------------------+----------------------------------------------------
   Reporter:  hm       |       Owner:  jng                    
       Type:  defect   |      Status:  new                    
   Priority:  medium   |   Milestone:  Maestro-4.0-maintenance
  Component:  Maestro  |     Version:                         
   Severity:  minor    |    Keywords:                         
External_id:           |  
-----------------------+----------------------------------------------------
 When I add an Oracle Data source, then I add a new layer and when
 selecting the Feature Class maestro fails with a null pointer exception.
 Debugging the code reveals that tje DatapropertyDefinition.GetDataType
 fails because the xmlType attribute is "xs:unsignedbyte" but the case is
 for "xs:unsignedByte".
 I do not know if the lower case version comes from KingOracle FDO
 provider, MapGuide 2.4 or Maestro.
 I recomend to rewrite the function to be case insensitive like this:

         public static DataPropertyType GetDataType(string xmlType)
         {
             switch (xmlType.ToLower())
             {
                 case "xs:hexbinary":
                 case "xs:base64binary":
                     return DataPropertyType.Blob;
                 case "xs:boolean":
                     return DataPropertyType.Boolean;
                 case "fdo:byte":
                 case "xs:byte":
                 case "xs:unsignedbyte":
                     return DataPropertyType.Byte;
                 case "xs:date":
                 case "xs:datetime":
                     return DataPropertyType.DateTime;
                 case "fdo:double":
                 case "fdo:decimal":
                 case "xs:decimal":
                 case "xs:double":
                     return DataPropertyType.Double;
                 case "fdo:int16":
                 case "xs:int16":
                 case "xs:short":
                 case "xs:unsignedshort":
                     return DataPropertyType.Int16;
                 case "fdo:int32":
                 case "xs:int32":
                 case "xs:integer":
                 case "xs:negativeinteger":
                 case "xs:nonNegativeinteger":
                 case "xs:nonPositiveinteger":
                 case "xs:positiveinteger":
                 case "xs:unsignedint":
                 case "xs:int":
                     return DataPropertyType.Int32;
                 case "fdo:int64":
                 case "xs:int64":
                 case "xs:long":
                 case "xs:unsignedlong":
                     return DataPropertyType.Int64;
                 case "xs:float":
                 case "xs:single":
                 case "fdo:single":
                     return DataPropertyType.Single;
                 case "xs:string":
                     return DataPropertyType.String;
                 case "fdo:clob":
                     return DataPropertyType.Clob;
                 default:
                     throw new ArgumentException();
             }
         }

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/2150>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list