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 132822 - Patch for issues 132795
Summary: Patch for issues 132795
Status: RESOLVED DUPLICATE of bug 132795
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:
Depends on:
Blocks:
 
Reported: 2008-04-15 00:11 UTC by scanti
Modified: 2010-10-08 01:32 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Diff Path (1.23 KB, text/plain)
2008-04-15 00:12 UTC, scanti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description scanti 2008-04-15 00:11:22 UTC
The problem was due to insertion of the comments between the the open and close tags
(http://schema2beans.netbeans.org/issues/show_bug.cgi?id=132795)

<TAG>some_comment</TAG>

even if there we no comments, a blank line was added preventing the schema to validate an empty bean.
I have attached a workaround that I have made. Probably It can be done better, but I had problems opening the file in my
IDE (NetBeans).

The patch is for JavaBeanClass.java I will attach it too


*** JavaBeanClass.java  2007-10-03 11:28:10.000000000 +0200
--- /opt/NBSOURCE/schema2beans/dev/src/org/netbeans/modules/schema2beansdev/JavaBeanClass.java  2008-04-14
23:34:44.000000000 +0200
***************
*** 1549,1555 ****
              // Go over the attributes
              for (int i = 0; i < size; i++) {
                  Property a = (Property) attrList.get(i);
!                 if (!a.isAttribute()) {
                      hasSubElements = true;
                      continue;
                  }
--- 1549,1556 ----
              // Go over the attributes
              for (int i = 0; i < size; i++) {
                  Property a = (Property) attrList.get(i);
!                 if (!a.isAttribute() && !"comment".equals(a.dtdName)) {
!                       //System.out.println("SCANTIDEBUG" + a.dtdName );
                      hasSubElements = true;
                      continue;
                  }
***************
*** 3123,3128 ****
--- 3124,3132 ----
      }

      protected void genWriteAttr(Property a, String varName) throws IOException {
+       if("comment".equals(a.dtdName)){
+               return;
+       }
          boolean isScalar = a.isScalar();
          String dtdName = a.dtdName;
          String namespace = a.getNamespace();
Comment 1 scanti 2008-04-15 00:12:02 UTC
Created attachment 60155 [details]
Diff Path
Comment 2 Erno Mononen 2008-04-16 10:40:20 UTC
I think the patch would introduce problems when you have an element named "comment", so as such I can't apply it to the 
code base.
Comment 3 David Konecny 2010-10-08 01:32:56 UTC

*** This bug has been marked as a duplicate of bug 132795 ***