Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is a malformed url, and why is it exceptional?

exceptional malformed URL
0
Posted

What is a malformed url, and why is it exceptional?

0

When you create an instance of the java.net.URL class, its constructor can throw a MalformedURLException. This occurs when the URL is invalid. When it is thrown, it isn’t because the host machine is down, or the URL path points to a missing file; a malformed URL exception is thrown when the URL cannot be correctly parsed. Common mistakes include :- • leaving out a protocol (eg “www.microsoft.com” instead of “http://www.microsoft.com/”) • specifying an invalid protocol (eg “www://netscape.com”) • leaving out the ‘:’ character (eg http//www.micrsoft.com/) MalformedURLException will not be thrown if :- • the host name is invalid (eg “www.microsoft-rules-the-world.com”) • the path is invalid (eg “http://www.microsoft.com/company_secrets.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123