Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1596

Getting "MalformedURLException: no protocol" on a valid URL

$
0
0

I'm trying to access and download an image hosted on Google Cloud Storage with a signed URL, but it's throwing a MalformedURLException if I pass the signed URL string along as a parameter. I know it's a valid URL, as pasting it into my browser works.

This doesn't work:

URL url = new URL(signedUrl);

However, pasting the output of System.out.println(signedUrl) into the URL object does work.

System.out.println(signedUrl);URL url = new URL("https://storage.googleapis.com/rydr/insurance_documents/test123.png?X...");

The exception:

java.lang.RuntimeException: java.net.MalformedURLException: no protocol: "https://storage.googleapis.com/rydr/insurance_documents/test123.png?X..."

Several years ago, a StackOverflow user had a similar problem here, but the suggestions of using .trim() failed to resolve the issue for me.

I also tried using DownloadManager, but it throws a similar exception:

java.lang.IllegalArgumentException: Can only download HTTP/HTTPS URIs: "https://storage.googleapis.com/rydr/insurance_documents/test123.png?X..."

Viewing all articles
Browse latest Browse all 1596

Trending Articles