[SPARK-4075][SPARK-4434] Fix the URI validation logic for Application Jar name.

This PR adds a regression test for SPARK-4434.