Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2118

Certificate error handling still incorrect

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.9.1
    • Fix Version/s: 0.9.1
    • Component/s: Go - Library
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      The error handling at LoadX509KeyPair() is still incorrect, it may now throw a Panic instead of reporting the error.

      Main reason is a slight scoping issue. If I read http://golang.org/doc/effective_go.html#redeclaration correctly, then

      var err error
      if foo, err := loadFoo(); err == nil {
          doSomething()
      }
      if err != nil {
        return err
      }
      

      is not the same as

      var err error
      foo, err := loadFoo()
      if err == nil {
          doSomething()
      }
      if err != nil {
        return err
      }
      

      because in the latter case a reassignment happens, while in the former case another, second err variable is declared. Therefore, in the first case the error check after the if may incorrectly report successful execution.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jensg Jens Geyer
                Reporter:
                jensg Jens Geyer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: