Commons CLI
  1. Commons CLI
  2. CLI-56

[cli] clone() method doesn't fully clone contents

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: CLI-1.x
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      Broken out from #19749.

      I'm a little weary of fixing this in case it was done this way on purpose... if
      anyone cloning options would care to reasure me it would be appreciated. Also
      need to decide if cli2 Options should be Cloneable

      Rob

        Activity

        Hide
        Henri Yandell added a comment -

        Removed clone() from Option - thus resolving this bug.

        Show
        Henri Yandell added a comment - Removed clone() from Option - thus resolving this bug.
        Hide
        Henri Yandell added a comment -

        clone() showed up in a commit from jkeyes, whose comment doesn't indicate any
        reason for the addition:

        http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/cli/trunk/src/java/org/apache/commons/cli/Option.java?rev=129799&r1=129796&r2=129799

        Show
        Henri Yandell added a comment - clone() showed up in a commit from jkeyes, whose comment doesn't indicate any reason for the addition: http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/cli/trunk/src/java/org/apache/commons/cli/Option.java?rev=129799&r1=129796&r2=129799
        Hide
        Sebb added a comment -

        The clone() method in CLI Option v 1.0 fails to clone the values array; this
        means one can't pick up the values from options like "-D property=value"

        Not sure whether the clone() method is really required - do options need to be
        cloneable? Might be better to provide a copy constructor instead, and avoid all
        the problems with clone.

        Show
        Sebb added a comment - The clone() method in CLI Option v 1.0 fails to clone the values array; this means one can't pick up the values from options like "-D property=value" Not sure whether the clone() method is really required - do options need to be cloneable? Might be better to provide a copy constructor instead, and avoid all the problems with clone.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rob Oxspring
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development