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 bu...@apache.org on 2002/06/20 21:57:04 UTC
DO NOT REPLY [Bug 10087] New: -
WSDL generation of JavaBean representation includes static fields.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10087>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10087
WSDL generation of JavaBean representation includes static fields.
Summary: WSDL generation of JavaBean representation includes
static fields.
Product: Axis
Version: beta-2
Platform: All
URL: http://www.ford.com
OS/Version: All
Status: NEW
Severity: Major
Priority: Other
Component: WSDL processing
AssignedTo: axis-dev@xml.apache.org
ReportedBy: jang@ford.com
CC: jang@ford.com
Java2WSDL and ?WSDL generate wrong WSDL for JavaBean when JavaBean includes
public static fields either final or not (Constants or class variables). Should
not include these types of fields in the generation of WSDL.
The problem code lies in ClassRep.java
partial code problem
--------------------
protected void addFields(Class cls) {
// Constructs a FieldRep for every public field and
// for every field that has JavaBean accessor methods
for (int i=0; i < cls.getDeclaredFields().length; i++) {
Field f = cls.getDeclaredFields()[i];
int mod = f.getModifiers();
if (Modifier.isPublic(mod) ||
isJavaBeanNormal(cls, f.getName(), f.getType()) ||
isJavaBeanIndexed(cls, f.getName(), f.getType())) {
if (_fieldNames.get(f.getName().toLowerCase()) == null) {
FieldRep fr;
if (!isJavaBeanIndexed(cls, f.getName(), f.getType())) {
fr = new FieldRep(f);
} else {
fr = new FieldRep();
fr.setName(f.getName());
fr.setType(f.getType().getComponentType());
fr.setIndexed(true);
}
_fields.add(fr);
_fieldNames.put(f.getName().toLowerCase(), fr);
}
}
}
----------------
Proposed fix:
----------------
protected void addFields(Class cls) {
// Constructs a FieldRep for every public field and
// for every field that has JavaBean accessor methods
for (int i=0; i < cls.getDeclaredFields().length; i++) {
Field f = cls.getDeclaredFields()[i];
int mod = f.getModifiers();
if (!(Modifier.isStatic(mod)) && (Modifier.isPublic(mod) ||
isJavaBeanNormal(cls, f.getName(), f.getType()) ||
isJavaBeanIndexed(cls, f.getName(), f.getType()))) {
if (_fieldNames.get(f.getName().toLowerCase()) == null) {
FieldRep fr;
if (!isJavaBeanIndexed(cls, f.getName(), f.getType())) {
fr = new FieldRep(f);
} else {
fr = new FieldRep();
fr.setName(f.getName());
fr.setType(f.getType().getComponentType());
fr.setIndexed(true);
}
_fields.add(fr);
_fieldNames.put(f.getName().toLowerCase(), fr);
}
}
}