Issue Details (XML | Word | Printable)

Key: CLI-141
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Henning Schmiedehausen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons CLI

CLI Option reports arguments incorrectly on toString()

Created: 06/Aug/07 02:16 PM   Updated: 18/Nov/07 09:41 PM
Return to search
Component/s: CLI-1.x
Affects Version/s: 1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works CLI-141-clean.patch 2007-11-13 11:29 PM Bjorn Townsend 2 kB
Text File Licensed for inclusion in ASF works option.patch 2007-08-06 02:17 PM Henning Schmiedehausen 1 kB

Resolution Date: 18/Nov/07 09:41 PM


 Description  « Hide
The Option class contains some logic around the "hasArg" boolean that seems to be cruft and no longer works correctly. There is no need for this boolean anymore and its only usage could be replaced with hasArg() / hasArgs() calls.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henning Schmiedehausen added a comment - 06/Aug/07 02:17 PM
Also contains serializable patch, apply with care.

Brian Egge added a comment - 09/Aug/07 07:37 AM
I agree with the hasArg change. My preference for serializable classes is to use the number which would be generated by serialver. This way, if someone is already serializing this class, it won't break their code if they don't upgrade both the client and server at the same time.

Other people prefer to start a 1L and increment each time the public interface changes. I don't know if Apache has a standard one way or the other.


Henning Schmiedehausen added a comment - 09/Aug/07 07:49 AM
You can not serialize the class currently. It is not serializable.

It has no version, because it needs no version. I don't know anything about a serialization standard @ Apache, but I consider 1L and incrementing to be more readable.

I don't really care about the version, as long as the classes become serializable. I have some time this weekend, so I could apply the patches, unless someone objects strongly.


Henri Yandell added a comment - 14/Aug/07 02:08 PM
Apply away

Henning Schmiedehausen added a comment - 14/Aug/07 02:55 PM
Will do.

Henri Yandell added a comment - 27/Oct/07 07:03 AM
Patch is wonky btw - it fails to apply against the branch, and when I look at it by hand, you've missed one of the hasArg usages.

Bjorn Townsend added a comment - 13/Nov/07 11:21 PM
Cleaned up the patch a little bit. It applies to the 1.x branch for me without any problems.

The hasArg instance that Henri thought Henning missed is not an issue – it's just a local variable. +1 to adopting this.


Henri Yandell added a comment - 18/Nov/07 09:41 PM
Patch added: r596140.