tomj        2002/06/20 14:17:38

  Modified:    java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
                        SchemaUtils.java
               java/src/org/apache/axis/utils axisNLS.properties
  Log:
  Address bug 9717 - schema types are not supported.
  This doesn't fix it, but we not emit a 'not supported' error instead of
  an undefined error.
  
  In the process, add a utility method for determining if a QName is a
  simple Schema type.
  
  Revision  Changes    Path
  1.8       +12 -2     
xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SymbolTable.java  20 Jun 2002 20:35:47 -0000      1.7
  +++ SymbolTable.java  20 Jun 2002 21:17:38 -0000      1.8
  @@ -444,10 +444,20 @@
           while (it.hasNext()) {
               Vector v = (Vector) it.next();
               for (int i = 0; i < v.size(); ++i) {
  -                if (v.get(i) instanceof Undefined) {
  +                SymTabEntry entry = (SymTabEntry) v.get(i);
  +
  +                // Check for a undefined XSD Schema Type and throw
  +                // an unsupported message instead of undefined
  +                if (entry instanceof UndefinedType && 
  +                    SchemaUtils.isSimpleSchemaType(entry.getQName())) {
  +                    throw new IOException(
  +                            JavaUtils.getMessage("unsupportedSchemaType00",
  +                                              entry.getQName().getLocalPart()));
  +                }
  +                if (entry instanceof Undefined) {
                       throw new IOException(
                               JavaUtils.getMessage("undefined00",
  -                            "" + ((TypeEntry)v.get(i)).getQName()));
  +                                                 entry.getQName().toString()));
                   }
               }
           }
  
  
  
  1.9       +72 -1     
xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SchemaUtils.java  20 Jun 2002 20:35:47 -0000      1.8
  +++ SchemaUtils.java  20 Jun 2002 21:17:38 -0000      1.9
  @@ -1061,7 +1061,7 @@
                   TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
   
                   // Need to add code here to get the qualified or unqualified
  -                // name.  Similar to the code around line 350 for elenments.
  +                // name.  Similar to the code around line 350 for elements.
                   // Rich Scheuerle
   
                   // Now get the name.
  @@ -1077,4 +1077,75 @@
           return v;
       }
   
  +    // list of all of the XSD types in Schema 2001
  +    private static String schemaTypes[] = {
  +        "string",
  +        "normalizedString",
  +        "token",        
  +        "byte",
  +        "unsignedByte",
  +        "base64Binary",
  +        "hexBinary",    
  +        "integer",
  +        "positiveInteger",
  +        "negativeInteger",
  +        "nonNegativeInteger",
  +        "nonPositiveInteger",
  +        "int",
  +        "unsignedInt",  
  +        "long",
  +        "unsignedLong",
  +        "short",
  +        "unsignedShort",
  +        "decimal",
  +        "float",
  +        "double",
  +        "boolean",
  +        "time",
  +        "dateTime",
  +        "duration",
  +        "date",
  +        "gMonth",
  +        "gYear",
  +        "gYearMonth",
  +        "gDay",
  +        "gMonthDay",
  +        "Name",
  +        "QName",
  +        "NCName",
  +        "anyURI",
  +        "language",
  +        "ID",
  +        "IDREF",
  +        "IDREFS",
  +        "ENTITY",
  +        "ENTITIES",
  +        "NOTATION",
  +        "NMTOKEN",
  +        "NMTOKENS"
  +    };
  +    
  +    /**
  +     * Determine if a string is a simple XML Schema type 
  +     */ 
  +    public static boolean isSimpleSchemaType(String s) {
  +        if (s == null)
  +            return false;
  +        
  +        for (int i = 0; i < schemaTypes.length; i++) {
  +            if (schemaTypes[i].equals(s))
  +                return true;
  +        }
  +        return false;
  +    }
  +    /**
  +     * Determine if a QName is a simple XML Schema type 
  +     */ 
  +    public static boolean isSimpleSchemaType(QName qname) {
  +        if (qname == null || 
  +            !Constants.isSchemaXSD(qname.getNamespaceURI())) {
  +            return false;
  +        }
  +        return isSimpleSchemaType(qname.getLocalPart());
  +    }
   }
  
  
  
  1.11      +3 -0      xml-axis/java/src/org/apache/axis/utils/axisNLS.properties
  
  Index: axisNLS.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/axisNLS.properties,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- axisNLS.properties        19 Jun 2002 16:13:18 -0000      1.10
  +++ axisNLS.properties        20 Jun 2002 21:17:38 -0000      1.11
  @@ -896,3 +896,6 @@
   beanCompatType00=The class {0} is not a bean class and cannot be converted into an 
xml schema type.  An xml schema anyType will be used to define this class in the wsdl 
file.
   beanCompatPkg00=The class {0} is defined in a java or javax package and cannot be 
converted into an xml schema type.  An xml schema anyType will be used to define this 
class in the wsdl file.
   beanCompatConstructor00=The class {0} does not contain a default constructor, which 
is a requirement for a bean class.  The class cannot be converted into an xml schema 
type.  An xml schema anyType will be used to define this class in the wsdl file.
  +
  +unsupportedSchemaType00=The XML Schema type ''{0}'' is not currently supported.
  +
  
  
  


Reply via email to