Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-170

TypeHandler prints messages to stderr

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: Validation
    • Labels:
      None

      Description

      Certain methods in TypeHandler print a message to stderr when they are unable to create the object they are to return. I don't think this should be. The documentation for each method clearly states that if it is unable to create the object, it returns null. If more information should be reported to the caller, these methods should be changed to throw an exception. I've removed the printing of these messages from TypeHandler.

      This fix also makes the unit test output clean. Right now, certain test cases exercise the "returns null" behavior of some of the TypeHandler methods, and this causes various error messages to be written to stderr which makes the test case output look unclean and like something has gone wrong when in fact everything is working correctly.

      Attached is a patch for this fix. The patch is against http://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x.

        Attachments

        1. CLI-170.patch
          5 kB
          Henri Yandell
        2. remove-messages-to-stderr.patch
          1 kB
          J. Lewis Muir

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jlmuir J. Lewis Muir
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: