qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (Jira)" <j...@apache.org>
Subject [jira] [Commented] (PROTON-1675) [cpp] Attempt to listen on invalid URL will not throw exception
Date Wed, 08 Apr 2020 07:28:00 GMT

    [ https://issues.apache.org/jira/browse/PROTON-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17077906#comment-17077906
] 

ASF subversion and git services commented on PROTON-1675:
---------------------------------------------------------

Commit 0e94fac055f46202b17ed01192f8dab84519322c in qpid-proton's branch refs/heads/jd_2020_04_cpp_throw_PROTON-1675
from Jiri Danek
[ https://gitbox.apache.org/repos/asf?p=qpid-proton.git;h=0e94fac ]

PROTON-1675 [cpp] Attempt to listen on invalid URL will not throw exception


> [cpp] Attempt to listen on invalid URL will not throw exception
> ---------------------------------------------------------------
>
>                 Key: PROTON-1675
>                 URL: https://issues.apache.org/jira/browse/PROTON-1675
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: proton-j-0.18.0
>            Reporter: Jiri Daněk
>            Assignee: Clifford Jansen
>            Priority: Major
>
> The test {{container_test.cpp/test_container_bad_address()}} is not checking that expected
exceptions are actually thrown. If I add these checks, the test starts failing.
> {noformat}
> diff --git a/proton-c/bindings/cpp/src/container_test.cpp b/proton-c/bindings/cpp/src/container_test.cpp
> index eb05ddbd..d1dc6628 100644
> --- a/proton-c/bindings/cpp/src/container_test.cpp
> +++ b/proton-c/bindings/cpp/src/container_test.cpp
> @@ -176,12 +176,18 @@ int test_container_bad_address() {
>  
>      proton::container c;
>      // Default fixed-option listener. Valgrind for leaks.
> -    try { c.listen("999.666.999.666:0"); } catch (const proton::error&) {}
> +    try {
> +        c.listen("999.666.999.666:0");
> +        FAIL("exception expected");
> +    } catch (const proton::error&) {}
>      c.run();
>      // Dummy listener.
>      test_listen_handler l;
>      test_handler h2("999.999.999.666", proton::connection_options());
> -    try { c.listen("999.666.999.666:0", l); } catch (const proton::error&) {}
> +    try {
> +        c.listen("999.666.999.666:0", l);
> +        FAIL("exception expected");
> +    } catch (const proton::error&) {}
>      c.run();
>      ASSERT(!l.on_open_);
>      ASSERT(!l.on_accept_);
> {noformat}
> No exception is ever thrown: invalid IP, port is already occupied, port is < 1025
and I am not root... never.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message