This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 72681 - IAE thrown from BeanProp
Summary: IAE thrown from BeanProp
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Schema2Beans (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: schema2beans-issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-15 09:27 UTC by Martin Adamek
Modified: 2006-03-02 21:02 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thrown exception (1.30 KB, text/plain)
2006-02-15 09:28 UTC, Martin Adamek
Details
Schema with problematic attributes (37.17 KB, text/xml)
2006-02-15 09:29 UTC, Martin Adamek
Details
Very primitive patch for inspiration. It handles this particular problem, but it's not systematic enough. (877 bytes, text/plain)
2006-02-15 09:32 UTC, Martin Adamek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Adamek 2006-02-15 09:27:27 UTC
When following attribute is defined in element in xsd:
<xsd:complexType name="entity">
  <xsd:attribute name="class" type="xsd:string" use="required"/>
...
and attrProp is set to true in s2b Ant task, following field with appropriate
getter.setter is created in generated Entity class:
static public final String CLASS2 = "Class2";
There is "Class2" name used, because getClass() is already existing method and
getClass2() is generated instead. Problem is in Entity's parent element -
EntityMappings, where folowing code is generated:
this.createAttribute(EMBEDDABLE, "class", "Class", ...)
but it should be:
this.createAttribute(EMBEDDABLE, "class", "Class2", ...).
"java.lang.IllegalArgumentException: Unknown attribute Class2 for property
Entity" is thrown for this call:
entityMappings.addEntity(entity);
Comment 1 Martin Adamek 2006-02-15 09:28:14 UTC
Created attachment 28887 [details]
Thrown exception
Comment 2 Martin Adamek 2006-02-15 09:29:28 UTC
Created attachment 28888 [details]
Schema with problematic attributes
Comment 3 Martin Adamek 2006-02-15 09:32:28 UTC
Created attachment 28889 [details]
Very primitive patch for inspiration. It handles this particular problem, but it's not systematic enough.
Comment 4 _ cliffwd 2006-02-21 19:40:14 UTC
The determination of whether or not something gets renamed (a number gets
appended) is made in BeanBuilder.java.  For attributes, it's in addAttrProp
around line 481.  It has access to the AttrProp and probably should change the
name in the AttrProp after determining that the property should get renamed.
Comment 5 _ cliffwd 2006-03-02 21:02:15 UTC
Fixed.

Checking in BeanBuilder.java;
/cvs/schema2beans/dev/src/org/netbeans/modules/schema2beansdev/BeanBuilder.java,v
 <--  BeanBuilder.java
new revision: 1.42.24.1; previous revision: 1.42
done