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 132795 - Code for empty elements generated uncorrectly
Summary: Code for empty elements generated uncorrectly
Status: RESOLVED WONTFIX
Alias: None
Product: ide
Classification: Unclassified
Component: Schema2Beans (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: schema2beans-issues@ide
URL:
Keywords:
: 132822 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-14 17:47 UTC by scanti
Modified: 2011-09-13 14:29 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Sample Schema (737 bytes, text/plain)
2008-04-14 17:48 UTC, scanti
Details
patch (829 bytes, patch)
2008-04-16 13:45 UTC, Erno Mononen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description scanti 2008-04-14 17:47:41 UTC
Hi I am using schema2beans and I had a few errors like these one:
When the beans writes to the file, the generated XML is wrong: it does not generates "<A />" or "<A></A>" it generates
<A>"Many spaces"  </A>

Everything works if I use BaseBean instead of JavaBeans, but I cannot use BaseBean because of another bug 

I am currently using an ant script to build the beans, this is the target, and I have attached a sample schema 
(NB is I enabled the keepElementPositions switch I have got a IndexOutOfBoundException and I other schema it generates
code that does not compile) 

<target name="bugTest" depends="clean-beans">
        
        <schema2beans schema="test/unit/src/com/streamsim/geodatamodel/bugtest/testSchema.xsd"
                      package="com.streamsim.geodatamodel.beans"
                      rootDir="test/unit/src"
                      docroot="root"
                      validate="true"
                      keepElementPositions="false"
                      vetoable="false"
                      dumptostring="true"
                      generatexmlio="true"
                      attributesasproperties="true"
                      setdefaults="true"
                      makedefaults="true"
                      
                      defaultsaccessable="true"
                      checkuptodate="false"
                      useinterfaces="false"                      
                      
                      removeunreferencednodes="true"
                      logsuspicious="true"
                      respectextension="true"
                      throwerrors="true"
                      standalone="true"
                      
                      extendbasebean="true"
                      useruntime="true"
                      outputtype="javabeans"
                      
                      
                      generatepropertyevents="true"
                      generateparentrefs="true"
                      generatestoreevents="true"
                      
                      comments="true"                      
                      
        />
</target>
Comment 1 scanti 2008-04-14 17:48:33 UTC
Created attachment 60146 [details]
Sample Schema
Comment 2 Erno Mononen 2008-04-15 12:30:13 UTC
Doesn't affect the IDE itself, so adding the NO61 keyword.
Comment 3 scanti 2008-04-15 15:33:50 UTC
I think I found a workaround for this 
http://schema2beans.netbeans.org/issues/show_bug.cgi?id=132822
Comment 4 Erno Mononen 2008-04-15 16:40:32 UTC
Thanks for the patch! I will test it out. I confirmed the problem, another way to workaround this is to skip comment 
processing (i.e. comments=false) if you don't need that functionality.
Comment 5 Erno Mononen 2008-04-16 13:45:42 UTC
Created attachment 60272 [details]
patch
Comment 6 Erno Mononen 2008-04-16 13:51:07 UTC
I attached an alternative patch that should fix this, I still need to do some further testing before integrating it to 
the code base; possibly some time next week if no problems are found. I'm also downgrading this to P2 as the issue has 
a somewhat limited impact. Your patch was useful, it lead me to the root cause of this, so thanks a lot for that and 
for reporting too. 
Comment 7 Erno Mononen 2008-06-17 10:35:12 UTC
I pushed the patch to the repository, changeset #77df9dba1765.
Comment 8 Jesse Glick 2008-06-17 17:12:50 UTC
You broke compilation of websvc.jaxrpc:

/space/src/nb/main/websvc.jaxrpc/src/org/netbeans/modules/websvc/jaxrpc/dev/dd/gen/wscreation/Bean.java:237: cannot find
symbol
symbol  : method sizeComments()
location: class org.netbeans.modules.websvc.jaxrpc.dev.dd.gen.wscreation.Bean
		if (sizeComments() > 0)
                    ^

Are you fixing? If not I will roll back your change as it is breaking javadoc-nbms and the production build.
Comment 9 Erno Mononen 2008-06-17 19:18:58 UTC
Rolled back, #8028e758074f.
Comment 10 Marian Mirilovic 2009-02-20 18:08:50 UTC
update no67 keyword
Comment 11 David Konecny 2010-10-08 01:32:56 UTC
*** Bug 132822 has been marked as a duplicate of this bug. ***
Comment 12 Petr Jiricka 2011-09-13 14:29:23 UTC
As this bug does not affect the NetBeans IDE and the Oracle NetBeans team is not planning to address it, I am closing this as WONTFIX. Anyone who would like to take this on and contribute the solution, please reopen and reassign to yourself.