jochen      2005/05/07 12:42:44

  Modified:    src/test/jaxb/jira Tag: v0_4 jaxme-21.xsd
               src/jaxme/org/apache/ws/jaxme/generator/sg Tag: v0_4
                        TypeSG.java SimpleTypeSG.java PropertySG.java
               src/jaxme/org/apache/ws/jaxme/generator/types Tag: v0_4
                        SimpleTypeSGImpl.java
               src/jaxme/org/apache/ws/jaxme/generator/sg/impl Tag: v0_4
                        JAXBTypeSG.java JAXBPropertySG.java
               src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg Tag:
                        v0_4 SimpleContentHandlerSG.java GroupUtil.java
               .        Tag: v0_4 status.xml
  Log:
  The PropertySG didn't distinguish clearly between the property name ("foo") 
and the generated fields name ("_foo"). As a consequence, invalid code has been 
generated in some cases.
  
  PR: JAXME-50
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.2.2.1   +15 -0     ws-jaxme/src/test/jaxb/jira/jaxme-21.xsd
  
  Index: jaxme-21.xsd
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/test/jaxb/jira/jaxme-21.xsd,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- jaxme-21.xsd      12 Aug 2004 00:04:28 -0000      1.2
  +++ jaxme-21.xsd      7 May 2005 19:42:44 -0000       1.2.2.1
  @@ -168,4 +168,19 @@
                <attribute name="lastLoginDate" type="dateTime"/>
        </complexType>
        
  +  <complexType name="VisualType">
  +    <all>
  +      <element name="periodlist">
  +        <complexType>
  +          <sequence>
  +            <element name="period" type="string" maxOccurs="unbounded">
  +              <annotation><appinfo>
  +                <jaxb:property generateIsSetMethod="true"/>
  +              </appinfo></annotation>
  +            </element>
  +          </sequence>
  +             </complexType>
  +       </element>
  +     </all>
  +  </complexType>
   </schema>
  
  
  
  No                   revision
  No                   revision
  1.7.2.1   +1 -0      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java
  
  Index: TypeSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/TypeSG.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- TypeSG.java       13 Oct 2004 22:51:53 -0000      1.7
  +++ TypeSG.java       7 May 2005 19:42:44 -0000       1.7.2.1
  @@ -116,6 +116,7 @@
     /** <p>Generates a set method returning an instance of this type.</p>
      */
     public JavaMethod getXMLSetMethod(JavaSource pSource, String pFieldName,
  +                                                                     String 
pParamName,
                                            String pMethodName, boolean 
pSetIsSet) throws SAXException;
   
     /** <p>Generates an "isSet" method returning whether the field is set.</p>
  
  
  
  1.5.2.2   +2 -2      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java
  
  Index: SimpleTypeSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/SimpleTypeSG.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- SimpleTypeSG.java 28 Apr 2005 23:57:40 -0000      1.5.2.1
  +++ SimpleTypeSG.java 7 May 2005 19:42:44 -0000       1.5.2.2
  @@ -148,8 +148,8 @@
   
     /** <p>Generates a set method for the simple type.</p>
      */
  -  public JavaMethod getXMLSetMethod(JavaSource pSource,
  -                                     String pFieldName, String pMethodName) 
throws SAXException;
  +  public JavaMethod getXMLSetMethod(JavaSource pSource, String pFieldName,
  +                                                                     String 
pParamName, String pMethodName) throws SAXException;
   
     /** <p>Adds code for validating the value <code>pValue</code> to the "add" 
or
      * "set" method <code>pMethod</code>.</p>
  
  
  
  1.4.2.1   +6 -1      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java
  
  Index: PropertySG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/PropertySG.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- PropertySG.java   8 Apr 2005 23:10:45 -0000       1.4
  +++ PropertySG.java   7 May 2005 19:42:44 -0000       1.4.2.1
  @@ -41,10 +41,15 @@
      */
     public String getCollectionType();
   
  -  /** <p>Returns the objects property name.</p>
  +  /** <p>Returns the objects field name. By default, this is the
  +   * property name with the prefix '_'.</p>
      */
     public String getXMLFieldName() throws SAXException;
   
  +  /** <p>Returns the objects property name.</p>
  +   */
  +  public String getPropertyName() throws SAXException;
  +
     /** <p>Returns the objects getter name.</p>
      */
     public String getXMLGetMethodName() throws SAXException;
  
  
  
  No                   revision
  No                   revision
  1.3.2.1   +2 -3      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java
  
  Index: SimpleTypeSGImpl.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/types/SimpleTypeSGImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- SimpleTypeSGImpl.java     30 Sep 2004 00:09:30 -0000      1.3
  +++ SimpleTypeSGImpl.java     7 May 2005 19:42:44 -0000       1.3.2.1
  @@ -110,11 +110,10 @@
     }
   
     public JavaMethod getXMLSetMethod(SimpleTypeSG pController, JavaSource 
pSource,
  -                                     String pFieldName, String pMethodName) 
throws SAXException {
  +                                    String pFieldName, String pParamName, 
String pMethodName) throws SAXException {
       if (pController.hasSetMethod()) {
  -      String pName = "p" + Character.toUpperCase(pFieldName.charAt(0)) + 
pFieldName.substring(1);
         JavaMethod jm = pSource.newJavaMethod(pMethodName, JavaQNameImpl.VOID, 
JavaSource.PUBLIC);
  -      DirectAccessible param = jm.addParam(pController.getRuntimeType(), 
pName);
  +      DirectAccessible param = jm.addParam(pController.getRuntimeType(), 
pParamName);
         if (!pSource.isInterface()) {
           pController.addValidation(jm, param);
           jm.addLine(pFieldName, " = ", param, ";");
  
  
  
  No                   revision
  No                   revision
  1.13.2.3  +5 -5      
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.13.2.2
  retrieving revision 1.13.2.3
  diff -u -r1.13.2.2 -r1.13.2.3
  --- JAXBTypeSG.java   27 Apr 2005 06:25:49 -0000      1.13.2.2
  +++ JAXBTypeSG.java   7 May 2005 19:42:44 -0000       1.13.2.3
  @@ -303,7 +303,7 @@
     }
   
     public JavaMethod getXMLGetMethod(TypeSG pController, JavaSource pSource,
  -                                     String pFieldName, String pMethodName) 
throws SAXException {
  +                                                                     String 
pFieldName, String pMethodName) throws SAXException {
       JavaQName runtimeType;
       if (pController.isComplex() && pFieldName.equals("value") && 
pController.getComplexTypeSG().hasSimpleContent()) {
         SimpleContentSG obj = 
pController.getComplexTypeSG().getSimpleContentSG();
  @@ -325,10 +325,10 @@
     }
   
     public JavaMethod getXMLSetMethod(TypeSG pController, JavaSource pSource,
  -                                         String pFieldName, String 
pMethodName,
  +                                         String pFieldName, String 
pParamName,
  +                                         String pMethodName,
                                       boolean pSetIsSet) throws SAXException {
        if (pController.isComplex()) {
  -             String pName = "p" + 
Character.toUpperCase(pFieldName.charAt(0)) + pFieldName.substring(1);
                JavaMethod jm = pSource.newJavaMethod(pMethodName, 
JavaQNameImpl.VOID, JavaSource.PUBLIC);
                JavaQName runtimeType;
                if (pFieldName.equals("value") && 
pController.getComplexTypeSG().hasSimpleContent()) {
  @@ -343,13 +343,13 @@
                else {
                        runtimeType = pController.getRuntimeType();
                }
  -             DirectAccessible param = jm.addParam(runtimeType, pName);
  +             DirectAccessible param = jm.addParam(runtimeType, pParamName);
                if (!pSource.isInterface()) {
                        jm.addLine(pFieldName, " = ", param, ";");
                }
                return jm;
        } else {
  -             JavaMethod jm = 
pController.getSimpleTypeSG().getXMLSetMethod(pSource, pFieldName, pMethodName);
  +             JavaMethod jm = 
pController.getSimpleTypeSG().getXMLSetMethod(pSource, pFieldName, pParamName, 
pMethodName);
                if (pSetIsSet  &&  pController.getRuntimeType().isPrimitive()) {
                        jm.addLine(getIsSetCheckFieldName(pFieldName), " = 
true;");
           }
  
  
  
  1.11.2.1  +18 -10    
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java
  
  Index: JAXBPropertySG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/JAXBPropertySG.java,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- JAXBPropertySG.java       8 Apr 2005 23:10:46 -0000       1.11
  +++ JAXBPropertySG.java       7 May 2005 19:42:44 -0000       1.11.2.1
  @@ -39,7 +39,6 @@
   import org.apache.ws.jaxme.xs.XSElement;
   import org.apache.ws.jaxme.xs.XSObject;
   import org.apache.ws.jaxme.xs.XSType;
  -import org.apache.ws.jaxme.xs.jaxb.JAXBElement;
   import org.apache.ws.jaxme.xs.jaxb.JAXBProperty;
   import org.apache.ws.jaxme.xs.jaxb.JAXBPropertyOwner;
   import org.xml.sax.SAXException;
  @@ -110,6 +109,10 @@
        public String getCollectionType(PropertySG pController) { return 
collectionType; }
        
        public String getXMLFieldName(PropertySG pController) throws 
SAXException {
  +             return fieldName;
  +     }
  +
  +     public String getPropertyName(PropertySG pController) throws 
SAXException {
                return propertyName;
        }
   
  @@ -121,7 +124,8 @@
           } else {
                prefix = "get";
           }
  -        String methodName = prefix + 
Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1);
  +             String propName = pController.getPropertyName();
  +        String methodName = prefix + 
Character.toUpperCase(propName.charAt(0)) + propName.substring(1);
           if (methodName.equals("getClass")) {
                throw new SAXException("Method name getClass() conflicts with 
java.lang.Object.getClass(), use jaxb:property to customize the property 
name.");
           }
  @@ -129,31 +133,35 @@
        }
        
        public String getXMLSetMethodName(PropertySG pController) throws 
SAXException {
  -             return "set" + Character.toUpperCase(propertyName.charAt(0)) + 
propertyName.substring(1);
  +             String propName = pController.getPropertyName();
  +             return "set" + Character.toUpperCase(propName.charAt(0)) + 
propName.substring(1);
        }
        
        public String getXMLIsSetMethodName(PropertySG pController) throws 
SAXException {
  +             String propName = pController.getPropertyName();
                return hasIsSetMethod(pController) ?
  -                                                                             
   "isSet" + Character.toUpperCase(propertyName.charAt(0)) + 
propertyName.substring(1) : null;
  +                                                                             
   "isSet" + Character.toUpperCase(propName.charAt(0)) + propName.substring(1) 
: null;
        }
   
        public JavaField getXMLField(PropertySG pController, JavaSource 
pSource) throws SAXException {
  -             return typeSG.getXMLField(pSource, fieldName, defaultValue);
  +             return typeSG.getXMLField(pSource, 
pController.getXMLFieldName(), defaultValue);
        }
        
        public JavaMethod getXMLGetMethod(PropertySG pController, JavaSource 
pSource) throws SAXException {
  -             return typeSG.getXMLGetMethod(pSource, fieldName,
  +             return typeSG.getXMLGetMethod(pSource, 
pController.getXMLFieldName(),
                                                                          
pController.getXMLGetMethodName());
        }
        
        public JavaMethod getXMLSetMethod(PropertySG pController, JavaSource 
pSource) throws SAXException {
  -             return typeSG.getXMLSetMethod(pSource, fieldName,
  -                                                   
pController.getXMLSetMethodName(),
  -                                      pController.hasIsSetMethod());
  +             String propName = pController.getPropertyName();
  +             String pName = "p" + Character.toUpperCase(propName.charAt(0)) 
+ propName.substring(1);
  +             return typeSG.getXMLSetMethod(pSource, 
pController.getXMLFieldName(),
  +                                                                       
pName, pController.getXMLSetMethodName(),
  +                                                                       
pController.hasIsSetMethod());
        }
        
        public JavaMethod getXMLIsSetMethod(PropertySG pController, JavaSource 
pSource) throws SAXException {
  -             return typeSG.getXMLIsSetMethod(pSource, fieldName,
  +             return typeSG.getXMLIsSetMethod(pSource, 
pController.getXMLFieldName(),
                                                                                
pController.getXMLIsSetMethodName());
        }
        
  
  
  
  No                   revision
  No                   revision
  1.4.2.2   +1 -1      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java
  
  Index: SimpleContentHandlerSG.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/SimpleContentHandlerSG.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- SimpleContentHandlerSG.java       28 Apr 2005 23:57:40 -0000      1.4.2.1
  +++ SimpleContentHandlerSG.java       7 May 2005 19:42:44 -0000       1.4.2.2
  @@ -44,7 +44,7 @@
                element.addLine("(", elementInterface, ") result");
                SimpleContentSG scSG = ctSG.getSimpleContentSG();
                TypedValue tv = createSimpleTypeConversion(result, 
scSG.getContentTypeSG(),
  -                                                                             
                   getParamResult(), scSG.getPropertySG().getXMLFieldName());
  +                                                                             
                   getParamResult(), scSG.getPropertySG().getPropertyName());
                scSG.getPropertySG().addValue(result, element, tv, null);
                return result;
        }
  
  
  
  1.2.2.1   +1 -1      
ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java
  
  Index: GroupUtil.java
  ===================================================================
  RCS file: 
/home/cvs/ws-jaxme/src/jaxme/org/apache/ws/jaxme/generator/sg/impl/ccsg/GroupUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- GroupUtil.java    8 Apr 2005 23:10:45 -0000       1.2
  +++ GroupUtil.java    7 May 2005 19:42:44 -0000       1.2.2.1
  @@ -30,7 +30,7 @@
                                        if (num++ > 0) {
                                                sb.append(sep);
                                        }
  -                                     String f = 
particle.getPropertySG().getXMLFieldName();
  +                                     String f = 
particle.getPropertySG().getPropertyName();
                                        
sb.append(Character.toUpperCase(f.charAt(0)) + f.substring(1));
                                        if (num == 3) {
                                                break;
  
  
  
  No                   revision
  No                   revision
  1.45.2.6  +8 -0      ws-jaxme/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/status.xml,v
  retrieving revision 1.45.2.5
  retrieving revision 1.45.2.6
  diff -u -r1.45.2.5 -r1.45.2.6
  --- status.xml        28 Apr 2005 23:57:40 -0000      1.45.2.5
  +++ status.xml        7 May 2005 19:42:44 -0000       1.45.2.6
  @@ -32,6 +32,14 @@
     <changes>
       <release version="0.4" date="Not yet published">
          <action dev="JW" type="fix" context="generator">
  +         The PropertySG didn't distinguish clearly between
  +         the property name ("foo") and the generated Java
  +         fields name ("_foo"). As a consequence, invalid
  +         code has been generated in some cases. See
  +         JAXME-50 in Jira. (Geert Barentsen,
  +         geert.barentsen at telenet.be)
  +       </action>
  +       <action dev="JW" type="fix" context="generator">
            A proper ParseConversionEvent is now generated, if the
            conversion of a simple type fails.
          </action>
  
  
  

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

Reply via email to