I've this portion of code:
/**
* Checks if the provided URL is valid.
*
* @param urlToCheck - The URL to check.
*
* @return boolean true if it's valid.
*/
protected boolean isUrlValid( String urlToCheck )
{
boolean isValid = true;
try
{
URL url = new URL( urlToCheck );
}
catch ( MalformedURLException exception )
{
isValid = false;
}
return isValid;
}
As you can see, I'm creating a new URL Object, which crashes if the String URL is not valid. This is working, the "problem" is that LINT says I'm not using url
variable.
I don't really have to use it, so here's my question:
- Is there any other better approach?
- Can I supress lint checking JUST for this line?