Server IP : 66.29.132.122 / Your IP : 18.224.54.168 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/puppetlabs/puppet/lib/ruby/vendor_gems/gems/hocon-1.3.1/lib/hocon/impl/ |
Upload File : |
# encoding: utf-8 require 'uri' require 'hocon/impl' # There are several places in the Java codebase that # use Java's URL constructor, and rely on it to throw # a `MalformedURLException` if the URL isn't valid. # # Ruby doesn't really have a similar constructor / # validator, so this is a little shim to hopefully # make the ported code match up with the upstream more # closely. class Hocon::Impl::Url class MalformedUrlError < StandardError def initialize(msg, cause = nil) super(msg) @cause = cause end end def initialize(url) begin # URI::parse wants a string @url = URI.parse(url.to_s) if !(@url.kind_of?(URI::HTTP)) raise MalformedUrlError, "Unrecognized URL: '#{url}'" end rescue URI::InvalidURIError => e raise MalformedUrlError.new("Unrecognized URL: '#{url}' (error: #{e})", e) end end def to_s @url.to_s end end