You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/07/08 16:29:08 UTC

cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava JavaEnumTypeWriter.java

dims        2004/07/08 07:29:08

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaEnumTypeWriter.java
  Log:
  Fix for AXIS-1441 - Cannot generate enum type where base type is URI
  from Lee Coomber
  
  Revision  Changes    Path
  1.29      +17 -1     ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaEnumTypeWriter.java
  
  Index: JavaEnumTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaEnumTypeWriter.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- JavaEnumTypeWriter.java	27 Mar 2004 18:23:26 -0000	1.28
  +++ JavaEnumTypeWriter.java	8 Jul 2004 14:29:08 -0000	1.29
  @@ -158,8 +158,24 @@
           // A public static variable of the base type is generated for each enumeration value.
           // Each variable is preceded by an _.
           for (int i = 0; i < ids.size(); i++) {
  -            pw.println("    public static final " + baseType + " _"
  +            
  +            // Need to catch the checked MalformedURIException for URI base types
  +            if(baseType.equals("org.apache.axis.types.URI")) {
  +                pw.println("    public static final " + baseType + " _" + ids.get(i) + ";");
  +                pw.println("    static {");
  +                pw.println("    	try {");
  +                pw.println("            _" + ids.get(i) + " = " + values.get(i) + ";");
  +                pw.println("        }");
  +                pw.println("        catch (org.apache.axis.types.URI.MalformedURIException mue) {");
  +                pw.println("            throw new java.lang.RuntimeException(mue.toString());");
  +                pw.println("        }");
  +                pw.println("    }");
  +                pw.println("");
  +            }
  +            else {
  +                pw.println("    public static final " + baseType + " _"
                       + ids.get(i) + " = " + values.get(i) + ";");
  +            }
           }
   
           // A public static variable is generated for each enumeration value.