tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fra...@apache.org
Subject svn commit: r524792 - /incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java
Date Mon, 02 Apr 2007 14:23:00 GMT
Author: frankb
Date: Mon Apr  2 07:23:00 2007
New Revision: 524792

URL: http://svn.apache.org/viewvc?view=rev&rev=524792
Log:
Fix for TUSCANY-1196

Modified:
    incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java

Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java?view=diff&rev=524792&r1=524791&r2=524792
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java
(original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/SDOXSDEcoreBuilder.java
Mon Apr  2 07:23:00 2007
@@ -120,16 +120,17 @@
 
   public EClassifier getEClassifier(XSDTypeDefinition xsdTypeDefinition) {
     EClassifier eClassifier = null;
-    if (rootSchema.getSchemaForSchemaNamespace().equals(xsdTypeDefinition.getTargetNamespace()))
{
-      eClassifier = 
-        getBuiltInEClassifier(
-          xsdTypeDefinition.getURI(), 
-          xsdTypeDefinition.getName());
-    } 
-    else if (xsdTypeDefinition.getContainer() == null) {
-      EPackage pkg = extendedMetaData.getPackage(xsdTypeDefinition.getTargetNamespace());
-      if(pkg != null) {
-         eClassifier = pkg.getEClassifier(xsdTypeDefinition.getName());
+    if (xsdTypeDefinition != null)
+    {
+      if (rootSchema.getSchemaForSchemaNamespace().equals(xsdTypeDefinition.getTargetNamespace()))
{
+        eClassifier = 
+          getBuiltInEClassifier(xsdTypeDefinition.getURI(), xsdTypeDefinition.getName());
+      } 
+      else if (xsdTypeDefinition.getContainer() == null) {
+        EPackage pkg = extendedMetaData.getPackage(xsdTypeDefinition.getTargetNamespace());
+        if(pkg != null) {
+          eClassifier = pkg.getEClassifier(xsdTypeDefinition.getName());
+        }
       }
     }
     if (eClassifier == null) {
@@ -140,7 +141,7 @@
   
   public EDataType getEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
     EDataType eClassifier = null;
-    if (rootSchema.getSchemaForSchemaNamespace().equals(xsdSimpleTypeDefinition.getTargetNamespace()))
{
+    if (xsdSimpleTypeDefinition != null && rootSchema.getSchemaForSchemaNamespace().equals(xsdSimpleTypeDefinition.getTargetNamespace()))
{
       eClassifier =
         (EDataType)getBuiltInEClassifier(
           xsdSimpleTypeDefinition.getURI(),
@@ -272,6 +273,7 @@
   }
   
   public EClass computeEClass(XSDComplexTypeDefinition xsdComplexTypeDefinition) {
+    if (xsdComplexTypeDefinition == null) return super.computeEClass(xsdComplexTypeDefinition);
     EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdComplexTypeDefinition.getTargetNamespace());
     if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage))
{
       EClassifier eclassifier = ePackage.getEClassifier(xsdComplexTypeDefinition.getName());
@@ -287,6 +289,7 @@
   }
 
   protected EClassifier computeEClassifier(XSDTypeDefinition xsdTypeDefinition) {
+    if (xsdTypeDefinition == null) return super.computeEClassifier(xsdTypeDefinition);
     EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdTypeDefinition.getTargetNamespace());
     if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage))
{
       EClassifier eclassifier = ePackage.getEClassifier(xsdTypeDefinition.getName());
@@ -305,6 +308,7 @@
   }
 
   protected EDataType computeEDataType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) {
+    if (xsdSimpleTypeDefinition == null) return super.computeEDataType(xsdSimpleTypeDefinition);
     EPackage ePackage = (EPackage)targetNamespaceToEPackageMap.get(xsdSimpleTypeDefinition.getTargetNamespace());
     if (ePackage != null && TypeHelperImpl.getBuiltInModels().contains(ePackage))
{
       EClassifier eclassifier = ePackage.getEClassifier(xsdSimpleTypeDefinition.getName());



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message