Proper fix for rejecting ftp URL with /r/n.

This change superseedes previous (broken) attempt and is based
on openJdk change:

changeset:   17022:ada6fcb7cfd1
user:        vtewari
date:        Fri Feb 10 10:11:10 2017 +0530
summary:     8170222: Better transfers of files

Tests rewrite taken from tobiast@ fix in http://ag/2141666.
Altered to not check for the case with username and no password
(because in current code this results in NPE, not sure if expected,
will check further) and removed the case with only '\r' in it, which
is not handled by openJdk fix, but shouldn't cause issues.

Test: FtpURLConnectionTest
Bug: 35784677
Change-Id: Ifdf6ebca362d1a5836d32b6f9663eff6c0c8f6ac
Merged-In: I02c4b9194d395f901ef1e8e6154e06add25b51c9
(cherry picked from commit 382a4d3fa486b844f4fd42c16ee41d9a38ba52f0)
2 files changed