Opened 12 years ago
Closed 12 years ago
#2150 closed defect (fixed)
DataPropertyDefinition.GetDataType is case sensitive
Reported by: | hm | Owned by: | jng |
---|---|---|---|
Priority: | medium | Milestone: | Maestro-4.0-maintenance |
Component: | Maestro | Version: | |
Severity: | minor | Keywords: | |
Cc: | External ID: |
Description
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();
}
}
Fixed r7129