@@ -53,11 +53,6 @@ public DownloadResult download(String fileUrl) {
53
53
try {
54
54
URL url = new URL (fileUrl );
55
55
56
- Code validationResult = validateUrl (url );
57
- if (validationResult != Code .SUCCESS ) {
58
- return DownloadResult .failed (validationResult );
59
- }
60
-
61
56
HttpURLConnection conn = openConnection (url );
62
57
if (conn == null ) {
63
58
return DownloadResult .failed (Code .UNEXPECTED_ERROR );
@@ -73,7 +68,7 @@ public DownloadResult download(String fileUrl) {
73
68
}
74
69
75
70
try (InputStream stream = new BufferedInputStream (conn .getInputStream ())) {
76
- validationResult = validateConnection (conn );
71
+ Code validationResult = validateConnection (conn );
77
72
if (validationResult != Code .SUCCESS ) {
78
73
return DownloadResult .failed (validationResult );
79
74
}
@@ -98,17 +93,6 @@ public DownloadResult download(String fileUrl) {
98
93
99
94
}
100
95
101
- private static Code validateUrl (URL url ) {
102
- // TODO: make it configurable
103
- String protocol = url .getProtocol ();
104
- if ("http" .equals (protocol )) {
105
- return Code .SUCCESS ;
106
- }
107
-
108
- LOG .debug ("Couldn't download file: unsupported protocol '{}'" , protocol );
109
- return Code .INVALID_PROTOCOL ;
110
- }
111
-
112
96
private static HttpURLConnection openConnection (URL url ) throws IOException {
113
97
URLConnection connection = url .openConnection ();
114
98
if (!(connection instanceof HttpURLConnection )) {
0 commit comments