[fdo-commits] r659 - in branches/3.2.x/Fdo/Unmanaged/Src/Fdo: Schema Xml

svn_fdo at osgeo.org svn_fdo at osgeo.org
Wed Jan 24 15:42:12 EST 2007


Author: romicadascalescu
Date: 2007-01-24 15:42:11 -0500 (Wed, 24 Jan 2007)
New Revision: 659

Modified:
   branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.h
   branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.xslt
   branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/FeaturePropertyReaderImpl.cpp
   branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/GeometryHandler.cpp
Log:
WFS provider: Crash loading a WFS layer

Modified: branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.h
===================================================================
--- branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.h	2007-01-24 17:48:16 UTC (rev 658)
+++ branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.h	2007-01-24 20:42:11 UTC (rev 659)
@@ -3893,13 +3893,17 @@
 "<xsl:template name=\"type_to_class\">",
 "    <xsl:param name=\"type\"/>",
 "    <xsl:choose>",
-"        <!-- Strip off \"Type\" suffix if type name ends in \"Type\" but is not \"Type\"-->",
-"        <xsl:when test=\"(string-length($type) &gt; 4) and (substring($type,string-length($type)-3) = 'Type')\">",
-"            <xsl:value-of select=\"substring($type,1,string-length($type)-4)\"/>",
-"        </xsl:when>",
-"        <xsl:otherwise>",
-"            <xsl:value-of select=\"$type\"/>",
-"        </xsl:otherwise>",
+"      <!-- Strip off \"Type\" suffix if type name ends in \"_Type\" but is not \"_Type\"-->",
+"      <xsl:when test=\"(string-length($type) &gt; 5) and (substring($type,string-length($type)-4) = '_Type')\">",
+"        <xsl:value-of select=\"substring($type,1,string-length($type)-5)\"/>",
+"      </xsl:when>",
+"      <!-- Strip off \"Type\" suffix if type name ends in \"Type\" but is not \"Type\"-->",
+"      <xsl:when test=\"(string-length($type) &gt; 4) and (substring($type,string-length($type)-3) = 'Type')\">",
+"        <xsl:value-of select=\"substring($type,1,string-length($type)-4)\"/>",
+"      </xsl:when>",
+"      <xsl:otherwise>",
+"        <xsl:value-of select=\"$type\"/>",
+"      </xsl:otherwise>",
 "    </xsl:choose>",
 "</xsl:template>",
 "",

Modified: branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.xslt
===================================================================
--- branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.xslt	2007-01-24 17:48:16 UTC (rev 658)
+++ branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Schema/SchemaFromExternal.xslt	2007-01-24 20:42:11 UTC (rev 659)
@@ -3889,13 +3889,17 @@
 <xsl:template name="type_to_class">
     <xsl:param name="type"/>
     <xsl:choose>
-        <!-- Strip off "Type" suffix if type name ends in "Type" but is not "Type"-->
-        <xsl:when test="(string-length($type) &gt; 4) and (substring($type,string-length($type)-3) = 'Type')">
-            <xsl:value-of select="substring($type,1,string-length($type)-4)"/>
-        </xsl:when>
-        <xsl:otherwise>
-            <xsl:value-of select="$type"/>
-        </xsl:otherwise>
+      <!-- Strip off "Type" suffix if type name ends in "_Type" but is not "_Type"-->
+      <xsl:when test="(string-length($type) &gt; 5) and (substring($type,string-length($type)-4) = '_Type')">
+        <xsl:value-of select="substring($type,1,string-length($type)-5)"/>
+      </xsl:when>
+      <!-- Strip off "Type" suffix if type name ends in "Type" but is not "Type"-->
+      <xsl:when test="(string-length($type) &gt; 4) and (substring($type,string-length($type)-3) = 'Type')">
+        <xsl:value-of select="substring($type,1,string-length($type)-4)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$type"/>
+      </xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 

Modified: branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/FeaturePropertyReaderImpl.cpp
===================================================================
--- branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/FeaturePropertyReaderImpl.cpp	2007-01-24 17:48:16 UTC (rev 658)
+++ branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/FeaturePropertyReaderImpl.cpp	2007-01-24 20:42:11 UTC (rev 659)
@@ -395,17 +395,23 @@
 	case ParsingState_BoundingShape:
 
 		//"Bounds" is FDO property for gml:boundedBy
-		tempGeometry =  m_geometryHandler->GetGeometry();
-		if (tempGeometry)
-		{
-			tempByteArray = tempGeometry->GetFgf();
+        try
+        {
+		    tempGeometry =  m_geometryHandler->GetGeometry();
+		    if (tempGeometry)
+		    {
+			    tempByteArray = tempGeometry->GetFgf();
 
-			isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
-				L"Bounds", 
-				tempByteArray->GetData(), 
-				tempByteArray->GetCount());
-		}		
-
+			    isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
+				    L"Bounds", 
+				    tempByteArray->GetData(), 
+				    tempByteArray->GetCount());
+		    }		
+        }
+        catch(FdoException* ex)
+        {ex->Release();}
+        catch(...)
+        {}
 		FDO_SAFE_RELEASE(tempGeometry);
 		FDO_SAFE_RELEASE(tempByteArray);
 
@@ -413,73 +419,87 @@
 
 	//gml geometry association
 	case ParsingState_GmlGeometryAssociation:
-    {
-		tempGeometry =  m_geometryHandler->GetGeometry();
-		tempByteArray = tempGeometry->GetFgf();
-        FdoStringP pPropName = name;
-        bool found = false;
-        if (NULL != m_lpClassStack.back())
+        try
         {
-            FdoXmlLpClassDefinition* classDef = m_lpClassStack.back();
-            FdoString* pBaseName = classDef->PropertyMappingNameFromGmlAlias(name);
-            if (pBaseName != NULL)
+            tempGeometry =  m_geometryHandler->GetGeometry();
+            if (tempGeometry)
             {
-                pPropName = pBaseName;
-                found = true;
+		        tempByteArray = tempGeometry->GetFgf();
+                FdoStringP pPropName = name;
+                bool found = false;
+                if (NULL != m_lpClassStack.back())
+                {
+                    FdoXmlLpClassDefinition* classDef = m_lpClassStack.back();
+                    FdoString* pBaseName = classDef->PropertyMappingNameFromGmlAlias(name);
+                    if (pBaseName != NULL)
+                    {
+                        pPropName = pBaseName;
+                        found = true;
+                    }
+                }
+                if (!found)
+                {
+                    pPropName = L"gml/";
+                    pPropName += name;
+                }
+                if (tempByteArray != NULL)
+                {
+                    isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
+			            pPropName,
+			            tempByteArray->GetData(), 
+			            tempByteArray->GetCount());
+                } else
+                {
+		            isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
+			            pPropName,
+			            NULL, 
+			            0);
+                }
             }
         }
-        if (!found)
-        {
-            pPropName = L"gml/";
-            pPropName += name;
-        }
-        if (tempByteArray != NULL)
-        {
-            isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
-			    pPropName,
-			    tempByteArray->GetData(), 
-			    tempByteArray->GetCount());
-        } else
-        {
-		    isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
-			    pPropName,
-			    NULL, 
-			    0);
-        }
-
+        catch(FdoException* ex)
+        {ex->Release();}
+        catch(...)
+        {}
 		FDO_SAFE_RELEASE(tempGeometry);
 		FDO_SAFE_RELEASE(tempByteArray);
-    }
 		break;
 
 	//geometry association
 	case ParsingState_GeometryAssociation:
-    {
-		tempGeometry =  m_geometryHandler->GetGeometry();
-		tempByteArray = tempGeometry->GetFgf();
-        FdoStringP pPropName = name;
-        if (NULL != m_lpClassStack.back())
+        try
         {
-            FdoXmlLpClassDefinition* classDef = m_lpClassStack.back();
-            FdoString* pBaseName = classDef->PropertyMappingNameFromGmlAlias(name);
-            if (pBaseName != NULL)
-                pPropName = pBaseName;
+            tempGeometry =  m_geometryHandler->GetGeometry();
+            if (tempGeometry)
+            {
+		        tempByteArray = tempGeometry->GetFgf();
+                FdoStringP pPropName = name;
+                if (NULL != m_lpClassStack.back())
+                {
+                    FdoXmlLpClassDefinition* classDef = m_lpClassStack.back();
+                    FdoString* pBaseName = classDef->PropertyMappingNameFromGmlAlias(name);
+                    if (pBaseName != NULL)
+                        pPropName = pBaseName;
+                }
+                if (tempByteArray != NULL) {
+		            isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
+			            pPropName,
+			            tempByteArray->GetData(), 
+			            tempByteArray->GetCount());
+                } else {
+		            isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
+			            pPropName,
+			            NULL, 
+			            0);
+                }
+            }
         }
-        if (tempByteArray != NULL) {
-		    isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
-			    pPropName,
-			    tempByteArray->GetData(), 
-			    tempByteArray->GetCount());
-        } else {
-		    isPauseParsing = curFeatureHandler->FeatureGeometricProperty(m_featureContext, 
-			    pPropName,
-			    NULL, 
-			    0);
-        }
-
-		FDO_SAFE_RELEASE(tempGeometry);
-		FDO_SAFE_RELEASE(tempByteArray);
-    }
+        catch(FdoException* ex)
+        {ex->Release();}
+        catch(...)
+        {}
+	    FDO_SAFE_RELEASE(tempGeometry);
+	    FDO_SAFE_RELEASE(tempByteArray);
 		break;
 
 	//Generic Complex Type

Modified: branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/GeometryHandler.cpp
===================================================================
--- branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/GeometryHandler.cpp	2007-01-24 17:48:16 UTC (rev 658)
+++ branches/3.2.x/Fdo/Unmanaged/Src/Fdo/Xml/GeometryHandler.cpp	2007-01-24 20:42:11 UTC (rev 659)
@@ -71,11 +71,10 @@
 	FdoXmlSaxHandler* nextHandler = NULL;
 	FdoXmlGeometry* newGeometry = NULL;
 
-    // in case we know the geometry type, use it
-	GmlGeometryType curType = m_typeGeomExpected;
-    //try to detect geometry type in case we don't know the geometry type
+	GmlGeometryType curType = getGmlGeometryType(name);
+    // in case we don't know the geometry type, use expected geom
     if (curType == GmlGeometryType_Unknown)
-        curType = getGmlGeometryType(name);
+        curType = m_typeGeomExpected;
     m_typeGeomExpected = GmlGeometryType_Unknown;
     
 	switch(curType)



More information about the fdo-commits mailing list