JiBX
  1. JiBX
  2. JIBX-93

missing optional attribute replaces value of the java field with its default value

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0-RC2
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      jdk 1.5
    • Number of attachments :
      0

      Description

      if the binding is:
      <value name="parallelism-level" field="parallelismLevel" style="attribute" usage="optional" />

      and java field is initialized:
      private int parallelismLevel=1;

      and XML instance does not contain attribute parallelism-level, then, after unmarshalling, the parallelismLevel==0

        Activity

        Hide
        Dennis Sosnoski added a comment -

        This behavior is by design for JiBX. Part of the reason for this is that JiBX reuses existing objects where available, so good programming practice says it should initialize all fields based on the input (rather than leaving their states indeterminant). If you'd like other options, please enter an enhancement request.

        See http://jira.codehaus.org/browse/JIBX-35 for a related discussion.

        Show
        Dennis Sosnoski added a comment - This behavior is by design for JiBX. Part of the reason for this is that JiBX reuses existing objects where available, so good programming practice says it should initialize all fields based on the input (rather than leaving their states indeterminant). If you'd like other options, please enter an enhancement request. See http://jira.codehaus.org/browse/JIBX-35 for a related discussion.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Maros Ivanco
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: