Skip to content
Commit fe57c5bf authored by Chiachang Wang's avatar Chiachang Wang Committed by Cherrypicker Worker
Browse files

Stop using invalid URL to prevent unexpected crash

Verify the input PAC Uri before performing follow-up actions.

Check if the URL is a valid URL to filter some invalid URLs since
these invalid URLs could not fall into any subclass of existing
URLConnections. When the PAC Uri is other invalid URL scheme, it
will cause an UnsupportedOperationException if there is no proper
subclass that implements the openConnection() method.
A malformed URL may crash the system.

Even it's a valid URL, some subclasses(e.g. JarURLConnection)
may not have openConnection() implemented. It will also hit the
problem, so convert the possbile exception from openConnection()
to re-throw it to IOException which is handled in the existing
code.

Bug: 219498290
Test: atest FrameworksNetTests CtsNetTestCases
Test: Test with malformed URL
Change-Id: I22903414380b62051f514e43b93af992f45740b4
(cherry picked from commit 6390b37a)
Merged-In: I22903414380b62051f514e43b93af992f45740b4
parent b1cf2a0c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment