mac         2005/04/26 23:23:26

  Modified:    src/jaxme/org/apache/ws/jaxme/generator/types
                        DurationSG.java DateTimeSG.java BooleanSG.java
                        DateSG.java ByteSG.java DecimalSG.java
                        Base64BinarySG.java HexBinarySG.java FloatSG.java
                        AtomicTypeSGImpl.java LongSG.java DoubleSG.java
                        IntegerSG.java TimeSG.java ShortSG.java
               src/test/jaxb defaults.xsd
               src/jaxme/org/apache/ws/jaxme/generator/sg/impl
                        JAXBTypeSG.java
               .        status.xml
  Log:
  Fixed default value generation for primitive types.
  
  Revision  Changes    Path
  1.5       +10 -4     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java
  
  Index: DurationSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DurationSG.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DurationSG.java   8 Apr 2005 23:10:45 -0000       1.4
  +++ DurationSG.java   27 Apr 2005 06:23:25 -0000      1.5
  @@ -53,10 +53,16 @@
   
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseDuration(pValue), DURATION_TYPE);
  -    } catch (RuntimeException e) {
  -      throw new LocSAXException("Failed to convert string value to dateTime 
instance: " + pValue, getLocator());
  -    }
  +     return new 
TypedValueImpl("org.apache.ws.jaxme.util.Duration.valueOf(\"" + pValue + "\")", 
DURATION_TYPE);
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   
     public TypedValue getCastToString(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, DirectAccessible pData) {
  
  
  
  1.6       +21 -4     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java
  
  Index: DateTimeSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateTimeSG.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DateTimeSG.java   8 Apr 2005 23:10:45 -0000       1.5
  +++ DateTimeSG.java   27 Apr 2005 06:23:25 -0000      1.6
  @@ -35,6 +35,7 @@
   import org.apache.ws.jaxme.js.TypedValue;
   import org.apache.ws.jaxme.js.impl.TypedValueImpl;
   import org.apache.ws.jaxme.xs.XSType;
  +import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
   import org.apache.ws.jaxme.xs.util.XsDateTimeFormat;
   import org.xml.sax.SAXException;
   
  @@ -56,10 +57,26 @@
       protected Class getFormatClass() { return XsDateTimeFormat.class; }
       public JavaQName getRuntimeType(SimpleTypeSG pController) { return 
CALENDAR_TYPE; }
   
  -    public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
  -        return new TypedValueImpl(new 
DatatypeConverterImpl().parseDateTime(pValue),
  -                                                               
getDatatypeType());
  -    }
  +    public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue)
  +                     throws SAXException {
  +             try {
  +                     Calendar calendar = new 
DatatypeConverterImpl().parseDate(pValue);
  +                     return new TypedValueImpl(
  +                                     new Object[] { "new 
java.util.GregorianCalendar("
  +                                                     + 
calendar.get(Calendar.YEAR) + ","
  +                                                     + 
calendar.get(Calendar.MONTH) + ","
  +                                                     + 
calendar.get(Calendar.DAY_OF_MONTH) + ")" },
  +                                     getDatatypeType());
  +             } catch (RuntimeException e) {
  +                     try {
  +                             throw new LocSAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue, getLocator());
  +                     } catch (Exception e1) {
  +                             throw new SAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue);
  +                     }
  +             }
  +     }
   
       public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, Object pData) throws SAXException {
           boolean mayBeDate;
  
  
  
  1.4       +9 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java
  
  Index: BooleanSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/BooleanSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BooleanSG.java    8 Apr 2005 23:10:45 -0000       1.3
  +++ BooleanSG.java    27 Apr 2005 06:23:25 -0000      1.4
  @@ -50,8 +50,14 @@
       try {
         return new TypedValueImpl(new 
DatatypeConverterImpl().parseBoolean(pValue) ? Boolean.TRUE : Boolean.FALSE,
                                                                
BOOLEAN_OBJECT_TYPE);
  -    } catch (RuntimeException e) {
  -      throw new LocSAXException("Failed to convert string value to boolean: 
" + pValue, getLocator());
  -    }
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.5       +22 -8     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java
  
  Index: DateSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DateSG.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DateSG.java       8 Apr 2005 23:10:45 -0000       1.4
  +++ DateSG.java       27 Apr 2005 06:23:25 -0000      1.5
  @@ -16,6 +16,8 @@
    */
   package org.apache.ws.jaxme.generator.types;
   
  +import java.util.Calendar;
  +
   import org.apache.ws.jaxme.generator.sg.SGFactory;
   import org.apache.ws.jaxme.generator.sg.SchemaSG;
   import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
  @@ -40,12 +42,24 @@
     protected String getDatatypeName() { return "Date"; }
     protected Class getFormatClass() { return XsDateFormat.class; }
     
  -  public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
  -    try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseDate(pValue),
  -                                                             
getDatatypeType());
  -    } catch (RuntimeException e) {
  -      throw new LocSAXException("Failed to convert string value to date 
instance: " + pValue, getLocator());
  -    }
  -  }
  +  public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue)
  +                     throws SAXException {
  +             try {
  +                     Calendar calendar = new 
DatatypeConverterImpl().parseDate(pValue);
  +                     return new TypedValueImpl(
  +                                     new Object[] { "new 
java.util.GregorianCalendar("
  +                                                     + 
calendar.get(Calendar.YEAR) + ","
  +                                                     + 
calendar.get(Calendar.MONTH) + ","
  +                                                     + 
calendar.get(Calendar.DAY_OF_MONTH) + ")" },
  +                                     getDatatypeType());
  +             } catch (RuntimeException e) {
  +                     try {
  +                             throw new LocSAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue, getLocator());
  +                     } catch (Exception e1) {
  +                             throw new SAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue);
  +                     }
  +             }
  +     }
   }
  
  
  
  1.4       +9 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java
  
  Index: ByteSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ByteSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteSG.java       8 Apr 2005 23:10:45 -0000       1.3
  +++ ByteSG.java       27 Apr 2005 06:23:25 -0000      1.4
  @@ -51,8 +51,14 @@
       try {
         return new TypedValueImpl(new Object[]{"((", BYTE_TYPE, ") ", new 
Byte(new DatatypeConverterImpl().parseByte(pValue)), ")"},
                                                                BYTE_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert byte value to integer: " 
+ pValue, getLocator());
  -    }
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.4       +10 -4     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java
  
  Index: DecimalSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DecimalSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DecimalSG.java    8 Apr 2005 23:10:45 -0000       1.3
  +++ DecimalSG.java    27 Apr 2005 06:23:25 -0000      1.4
  @@ -51,10 +51,16 @@
   
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseDecimal(pValue), DECIMAL_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to 
BigInteger: " + pValue, getLocator());
  -    }
  +     return new TypedValueImpl("new java.math.BigDecimal(\"" + pValue + 
"\")", DECIMAL_TYPE);
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   
     public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, SGlet pSGlet) throws SAXException {
  
  
  
  1.4       +0 -8      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java
  
  Index: Base64BinarySG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/Base64BinarySG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Base64BinarySG.java       8 Apr 2005 23:10:45 -0000       1.3
  +++ Base64BinarySG.java       27 Apr 2005 06:23:25 -0000      1.4
  @@ -48,14 +48,6 @@
     protected String getDatatypeName() { return "Base64Binary"; }
     protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
   
  -  public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
  -    try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseBase64Binary(pValue), byte[].class);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to 
Base64Binary: " + pValue, getLocator());
  -    }
  -  }
  -
     public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, SGlet pSGlet) throws SAXException {
       LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
       f.addLine(pValue);
  
  
  
  1.4       +0 -8      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java
  
  Index: HexBinarySG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/HexBinarySG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HexBinarySG.java  8 Apr 2005 23:10:45 -0000       1.3
  +++ HexBinarySG.java  27 Apr 2005 06:23:25 -0000      1.4
  @@ -48,14 +48,6 @@
     protected String getDatatypeName() { return "HexBinary"; }
     protected JavaQName getDatatypeType() { return BYTE_ARRAY_TYPE; }
   
  -  public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
  -    try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseHexBinary(pValue), BYTE_ARRAY_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to 
HexBinary: " + pValue, getLocator());
  -    }
  -  }
  -
     public void forAllNonNullValues(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, SGlet pSGlet) throws SAXException {
       LocalJavaField f = pMethod.newJavaField(BYTE_ARRAY_TYPE);
       f.addLine(pValue);
  
  
  
  1.4       +9 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java
  
  Index: FloatSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/FloatSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FloatSG.java      8 Apr 2005 23:10:45 -0000       1.3
  +++ FloatSG.java      27 Apr 2005 06:23:25 -0000      1.4
  @@ -50,8 +50,14 @@
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
         return new TypedValueImpl(new Float(new 
DatatypeConverterImpl().parseFloat(pValue)) + "f", FLOAT_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to float: " 
+ pValue, getLocator());
  -    }
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.4       +19 -0     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java
  
  Index: AtomicTypeSGImpl.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/AtomicTypeSGImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AtomicTypeSGImpl.java     8 Apr 2005 23:10:45 -0000       1.3
  +++ AtomicTypeSGImpl.java     27 Apr 2005 06:23:25 -0000      1.4
  @@ -33,6 +33,7 @@
   import org.apache.ws.jaxme.js.TypedValue;
   import org.apache.ws.jaxme.js.impl.TypedValueImpl;
   import org.apache.ws.jaxme.xs.XSType;
  +import org.apache.ws.jaxme.xs.parser.impl.LocSAXException;
   import org.xml.sax.SAXException;
   
   
  @@ -58,6 +59,24 @@
       return atomicTypeSG;
     }
   
  +   public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue)
  +                     throws SAXException {
  +             try {
  +                     return new TypedValueImpl(new Object[] {
  +                                     "javax.xml.bind.DatatypeConverter",
  +                                     ".parse" + getDatatypeName() + "(\"", 
pValue, "\")" },
  +                                     getDatatypeType());
  +             } catch (RuntimeException e) {
  +                     try {
  +                             throw new LocSAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue, getLocator());
  +                     } catch (Exception e1) {
  +                             throw new SAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue);
  +                     }
  +             }
  +     }
  +  
     public TypedValue getCastFromString(SimpleTypeSG pController, JavaMethod 
pMethod, Object pValue, Object pData) throws SAXException {
        Object value;
        if (pData == null) {
  
  
  
  1.4       +9 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java
  
  Index: LongSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/LongSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LongSG.java       8 Apr 2005 23:10:45 -0000       1.3
  +++ LongSG.java       27 Apr 2005 06:23:25 -0000      1.4
  @@ -50,8 +50,14 @@
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
         return new TypedValueImpl(new Long(new 
DatatypeConverterImpl().parseLong(pValue)) + "l", LONG_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to long: " + 
pValue, getLocator());
  -    }
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.4       +10 -4     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java
  
  Index: DoubleSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/DoubleSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DoubleSG.java     8 Apr 2005 23:10:45 -0000       1.3
  +++ DoubleSG.java     27 Apr 2005 06:23:25 -0000      1.4
  @@ -49,9 +49,15 @@
   
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
  -      return new TypedValueImpl(new Double(new 
DatatypeConverterImpl().parseDouble(pValue)), getDatatypeType());
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to double: " 
+ pValue, getLocator());
  -    }
  +     return new TypedValueImpl(new Double(new 
DatatypeConverterImpl().parseDouble(pValue)) + "d", getDatatypeType());
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.5       +1 -1      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java
  
  Index: IntegerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/IntegerSG.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- IntegerSG.java    8 Apr 2005 23:10:45 -0000       1.4
  +++ IntegerSG.java    27 Apr 2005 06:23:25 -0000      1.5
  @@ -54,7 +54,7 @@
   
     public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
       try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseInteger(pValue), INTEGER_TYPE);
  +     return new TypedValueImpl("new java.math.BigInteger(\"" + pValue + 
"\")", INTEGER_TYPE);
       } catch (NumberFormatException e) {
         throw new LocSAXException("Failed to convert string value to 
BigInteger: " + pValue, getLocator());
       }
  
  
  
  1.5       +25 -7     
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java
  
  Index: TimeSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/TimeSG.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TimeSG.java       8 Apr 2005 23:10:45 -0000       1.4
  +++ TimeSG.java       27 Apr 2005 06:23:25 -0000      1.5
  @@ -16,6 +16,8 @@
    */
   package org.apache.ws.jaxme.generator.types;
   
  +import java.util.Calendar;
  +
   import org.apache.ws.jaxme.generator.sg.SGFactory;
   import org.apache.ws.jaxme.generator.sg.SchemaSG;
   import org.apache.ws.jaxme.generator.sg.SimpleTypeSG;
  @@ -41,11 +43,27 @@
     protected String getDatatypeName() { return "Time"; }
     protected Class getFormatClass() { return XsTimeFormat.class; }
     
  -  public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue) throws SAXException {
  -    try {
  -      return new TypedValueImpl(new 
DatatypeConverterImpl().parseTime(pValue), getDatatypeType());
  -    } catch (RuntimeException e) {
  -      throw new LocSAXException("Failed to convert string value to time 
instance: " + pValue, getLocator());
  -    }
  -  }
  +    public TypedValue getCastFromString(SimpleTypeSG pController, String 
pValue)
  +                     throws SAXException {
  +             try {
  +                     Calendar calendar = new 
DatatypeConverterImpl().parseTime(pValue);
  +                     return new TypedValueImpl(
  +                                     new Object[] { "new 
java.util.GregorianCalendar("
  +                                                     + 
calendar.get(Calendar.YEAR) + ","
  +                                                     + 
calendar.get(Calendar.MONTH) + ","
  +                                                     + 
calendar.get(Calendar.DAY_OF_MONTH) + ","
  +                                                     + 
calendar.get(Calendar.HOUR_OF_DAY) + ","
  +                                                     + 
calendar.get(Calendar.MINUTE) + ","
  +                                                     + 
calendar.get(Calendar.SECOND) + ")" },
  +                                     getDatatypeType());
  +             } catch (RuntimeException e) {
  +                     try {
  +                             throw new LocSAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue, getLocator());
  +                     } catch (Exception e1) {
  +                             throw new SAXException("Failed to convert 
string value to "
  +                                             + getDatatypeName() + " 
instance: " + pValue);
  +                     }
  +             }
  +     }
   }
  
  
  
  1.4       +9 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java
  
  Index: ShortSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/ShortSG.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ShortSG.java      8 Apr 2005 23:10:45 -0000       1.3
  +++ ShortSG.java      27 Apr 2005 06:23:25 -0000      1.4
  @@ -51,8 +51,14 @@
       try {
         return new TypedValueImpl(new Object[]{"((", SHORT_TYPE, ")", new 
Short(new DatatypeConverterImpl().parseShort(pValue)), ")"},
                                                                SHORT_TYPE);
  -    } catch (NumberFormatException e) {
  -      throw new LocSAXException("Failed to convert string value to short: " 
+ pValue, getLocator());
  -    }
  +     } catch (RuntimeException e) {
  +             try {
  +                     throw new LocSAXException("Failed to convert string 
value to "
  +                                     + getDatatypeName() + " instance: " + 
pValue, getLocator());
  +             } catch (Exception e1) {
  +                     throw new SAXException("Failed to convert string value 
to "
  +                                     + getDatatypeName() + " instance: " + 
pValue);
  +             }
  +     }
     }
   }
  
  
  
  1.3       +55 -0     ws-jaxme/src/test/jaxb/defaults.xsd
  
  Index: defaults.xsd
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/test/jaxb/defaults.xsd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- defaults.xsd      23 Jul 2004 07:17:57 -0000      1.2
  +++ defaults.xsd      27 Apr 2005 06:23:26 -0000      1.3
  @@ -48,4 +48,59 @@
          </xs:sequence>

        </xs:complexType>

     </xs:element>

  +

  +  <xs:element name="defaultValuesElt">

  +     <xs:complexType>

  +             <xs:attribute name="string" type="xs:string" default="string" />

  +             <xs:attribute name="boolean" type="xs:boolean" default="true" />

  +             <xs:attribute name="float" type="xs:float" default="1" />

  +             <xs:attribute name="double" type="xs:double" default="1" />

  +             <xs:attribute name="decimal" type="xs:decimal" default="1" />

  +             <xs:attribute name="duration" type="xs:duration"

  +                     default="P1D" />

  +             <xs:attribute name="dateTime" type="xs:dateTime"

  +                     default="2001-12-31T12:30:30" />

  +             <xs:attribute name="time" type="xs:time" default="12:00:00" />

  +             <xs:attribute name="date" type="xs:date" default="2002-01-01" />

  +             <xs:attribute name="hexBinary" type="xs:hexBinary"

  +                     default="0F00" />

  +             <xs:attribute name="base64Binary" type="xs:base64Binary"

  +                     default="B64S" />

  +             <xs:attribute name="anyURI" type="xs:anyURI"

  +                     default="http://tempuri.org"; />

  +             <xs:attribute name="QName" type="xs:QName" default="QName" />

  +             <xs:attribute name="normalizedString"

  +                     type="xs:normalizedString" default="" />

  +             <xs:attribute name="token" type="xs:token" default="token" />

  +             <xs:attribute name="language" type="xs:language" default="EN" />

  +             <xs:attribute name="NMTOKEN" type="xs:NMTOKEN"

  +                     default="NMTOKEN" />

  +             <xs:attribute name="NMTOKENS" type="xs:NMTOKENS"

  +                     default="NMTOKENS,NMTOKENS1"/>                  

  +             <xs:attribute name="Name" type="xs:Name" default="Name" />

  +             <xs:attribute name="NCName" type="xs:NCName" default="NCName" />

  +             <xs:attribute name="IDREF" type="xs:IDREF" default="idvalue0" />

  +             <xs:attribute name="integer" type="xs:integer" default="1" />

  +             <xs:attribute name="nonPositiveInteger"

  +                     type="xs:nonPositiveInteger" default="-1" />

  +             <xs:attribute name="negativeInteger" type="xs:negativeInteger"

  +                     default="-1" />

  +             <xs:attribute name="long" type="xs:long" default="1" />

  +             <xs:attribute name="int" type="xs:int" default="1" />

  +             <xs:attribute name="short" type="xs:short" default="1" />

  +             <xs:attribute name="byte" type="xs:byte" default="1" />

  +             <xs:attribute name="nonNegativeInteger"

  +                     type="xs:nonNegativeInteger" default="1" />

  +             <xs:attribute name="unsignedLong" type="xs:unsignedLong"

  +                     default="1" />

  +             <xs:attribute name="unsignedInt" type="xs:unsignedInt"

  +                     default="1" />

  +             <xs:attribute name="unsignedShort" type="xs:unsignedShort"

  +                     default="1" />

  +             <xs:attribute name="unsignedByte" type="xs:unsignedByte"

  +                     default="1" />

  +             <xs:attribute name="positiveInteger" type="xs:positiveInteger"

  +                     default="1" />

  +     </xs:complexType>

  +  </xs:element>

   </xs:schema>

  
  
  
  1.15      +2 -7      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java
  
  Index: JAXBTypeSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBTypeSG.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JAXBTypeSG.java   20 Apr 2005 19:30:15 -0000      1.14
  +++ JAXBTypeSG.java   27 Apr 2005 06:23:26 -0000      1.15
  @@ -292,15 +292,10 @@
         if (!pController.isComplex()) {
           Object o = pController.getSimpleTypeSG().getInitialValue(pSource);
           if (o == null && pDefaultValue != null) {
  -          if (runtimeType.equals(StringSG.STRING_TYPE)) {
  -            o = "\"" + pDefaultValue + "\"";
  -          }
  -          else {
  -            o = pDefaultValue;
  -          }
  +            o = 
pController.getSimpleTypeSG().getCastFromString(pDefaultValue);
           }
           if (o != null) {
  -          jf.addLine(o);
  +            jf.addLine(o);
           }
         }
         return jf;
  
  
  
  1.51      +4 -0      ws-jaxme/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/status.xml,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- status.xml        25 Apr 2005 19:59:19 -0000      1.50
  +++ status.xml        27 Apr 2005 06:23:26 -0000      1.51
  @@ -36,6 +36,10 @@
          </action>
        </release>
       <release version="0.4" date="Not yet published">
  +      <action dev="NM" type="fix" context="generator">
  +             Fixed default value generation for primitive types. 
  +             See JAXME-47 in Jira.
  +      </action>
          <action dev="JW" type="fix" context="xs">
            Fixed that recursive xs:include caused an endless loop.
                (Daniel Barclay, daniel at fgm.com)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to