You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2013/08/13 22:26:48 UTC

[jira] [Updated] (THRIFT-2118) Certificate error handling still incorrect

     [ https://issues.apache.org/jira/browse/THRIFT-2118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jens Geyer updated THRIFT-2118:
-------------------------------

    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

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

is not the same as 

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

because in the latter case a reassignment happens, while in the former case another, second err variable is declared - see the § remark in the linked doc. Therefore, in the first case the comparison may fail.



  was:
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

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

is not the same as 

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

because in the latter case a reassignment happens, while in the former case another, second err variable is declared - see the § remark in the linked doc. Therefore, in the first case the comparison may fail.



    
> Certificate error handling still incorrect
> ------------------------------------------
>
>                 Key: THRIFT-2118
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2118
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Library
>    Affects Versions: 0.9.1
>            Reporter: Jens Geyer
>            Assignee: Jens Geyer
>            Priority: Trivial
>             Fix For: 0.9.1
>
>
> 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
> {code}
> var err error
> if foo, err := loadFoo(); err == nil {
>     doSomething()
> }
> if err != nil {
>   return err
> }
> {code}
> is not the same as 
> {code}
> var err error
> foo, err := loadFoo()
> if err == nil {
>     doSomething()
> }
> if err != nil {
>   return err
> }
> {code}
> because in the latter case a reassignment happens, while in the former case another, second err variable is declared - see the § remark in the linked doc. Therefore, in the first case the comparison may fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira