File tree Expand file tree Collapse file tree 4 files changed +8
-34
lines changed Expand file tree Collapse file tree 4 files changed +8
-34
lines changed Original file line number Diff line number Diff line change @@ -1328,7 +1328,7 @@ def new_connection
13281328 # Force connect to see if there's a connection error
13291329 connection . socket
13301330 connection
1331- rescue Errno ::ECONNREFUSED , Errno ::ETIMEDOUT , Net :: LDAP :: ConnectionRefusedError => e
1331+ rescue Errno ::ECONNREFUSED , Errno ::ETIMEDOUT => e
13321332 @result = {
13331333 :resultCode => 52 ,
13341334 :errorMessage => ResultStrings [ ResultCodeUnavailable ] ,
Original file line number Diff line number Diff line change 11class Net ::LDAP
2- class LdapError < StandardError
3- def message
4- "Deprecation warning: Net::LDAP::LdapError is no longer used. Use Net::LDAP::Error or rescue one of it's subclasses. \n " + super
5- end
6- end
7-
82 class Error < StandardError ; end
93
104 class AlreadyOpenedError < Error ; end
115 class SocketError < Error ; end
12- class ConnectionRefusedError < Error ;
13- def initialize ( *args )
14- warn_deprecation_message
15- super
16- end
17-
18- def message
19- warn_deprecation_message
20- super
21- end
22-
23- private
24-
25- def warn_deprecation_message
26- warn "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead."
27- end
28- end
296 class ConnectionError < Error
307 def self . new ( errors )
318 error = errors . first . first
329 if errors . size == 1
33- if error . kind_of? Errno ::ECONNREFUSED
34- return Net ::LDAP ::ConnectionRefusedError . new ( error . message )
35- end
10+ return error if error . is_a? Errno ::ECONNREFUSED
3611
3712 return Net ::LDAP ::Error . new ( error . message )
3813 end
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ def test_bind_tls_with_bad_hostname_verify_peer_ca_fails
7474 ca_file : CA_FILE } ,
7575 )
7676 error = assert_raise Net ::LDAP ::Error ,
77- Net :: LDAP :: ConnectionRefusedError do
77+ Errno :: ECONNREFUSED do
7878 @ldap . bind BIND_CREDS
7979 end
8080 assert_equal (
@@ -90,7 +90,7 @@ def test_bind_tls_with_bad_hostname_ca_default_opt_merge_fails
9090 tls_options : TLS_OPTS . merge ( ca_file : CA_FILE ) ,
9191 )
9292 error = assert_raise Net ::LDAP ::Error ,
93- Net :: LDAP :: ConnectionRefusedError do
93+ Errno :: ECONNREFUSED do
9494 @ldap . bind BIND_CREDS
9595 end
9696 assert_equal (
@@ -106,7 +106,7 @@ def test_bind_tls_with_bad_hostname_ca_no_opt_merge_fails
106106 tls_options : { ca_file : CA_FILE } ,
107107 )
108108 error = assert_raise Net ::LDAP ::Error ,
109- Net :: LDAP :: ConnectionRefusedError do
109+ Errno :: ECONNREFUSED do
110110 @ldap . bind BIND_CREDS
111111 end
112112 assert_equal (
@@ -141,7 +141,7 @@ def test_bind_tls_with_bogus_hostname_system_ca_fails
141141 @ldap . host = 'cert.mismatch.example.org'
142142 @ldap . encryption ( method : :start_tls , tls_options : { } )
143143 error = assert_raise Net ::LDAP ::Error ,
144- Net :: LDAP :: ConnectionRefusedError do
144+ Errno :: ECONNREFUSED do
145145 @ldap . bind BIND_CREDS
146146 end
147147 assert_equal (
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ def test_result_for_connection_failed_is_set
6161
6262 ldap_client = Net ::LDAP . new ( host : '127.0.0.1' , port : 12345 )
6363
64- assert_raise Net :: LDAP :: ConnectionRefusedError do
64+ assert_raise Errno :: ECONNREFUSED do
6565 ldap_client . bind ( method : :simple , username : 'asdf' , password : 'asdf' )
6666 end
6767
@@ -86,11 +86,10 @@ def test_blocked_port
8686 def test_connection_refused
8787 connection = Net ::LDAP ::Connection . new ( :host => "fail.Errno::ECONNREFUSED" , :port => 636 , :socket_class => FakeTCPSocket )
8888 stderr = capture_stderr do
89- assert_raise Net :: LDAP :: ConnectionRefusedError do
89+ assert_raise Errno :: ECONNREFUSED do
9090 connection . socket
9191 end
9292 end
93- assert_equal ( "Deprecation warning: Net::LDAP::ConnectionRefused will be deprecated. Use Errno::ECONNREFUSED instead.\n " , stderr )
9493 end
9594
9695 def test_connection_timeout
You can’t perform that action at this time.
0 commit comments