Yair Zaslavsky has posted comments on this change. Change subject: uutils: Extract connectionBuilder class ......................................................................
Patch Set 7: (5 comments) http://gerrit.ovirt.org/#/c/33479/7/backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/http/ConnectionBuilder.java File backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/http/ConnectionBuilder.java: > I still would have called this HttpURLConnectionBuilder... or Factory... to Done Line 1: package org.ovirt.engine.core.uutils.http; Line 2: Line 3: import java.io.File; Line 4: import java.io.FileInputStream; Line 43: Line 44: public ConnectionBuilder setURL(String url) { Line 45: try { Line 46: this.url = new URL(url); Line 47: if (!this.url.getProtocol().equalsIgnoreCase("http") && !this.url.getProtocol().equalsIgnoreCase("https")) { > you can remove this validation from this try-catch block and replace it wit see Alon's comment. Line 48: throw new RuntimeException("The URL " + url + " does not denote to an HTTP or HTTPS URL"); Line 49: } Line 50: } catch (MalformedURLException e) { Line 51: throw new IllegalArgumentException(url + " is not a valid URL"); Line 43: Line 44: public ConnectionBuilder setURL(String url) { Line 45: try { Line 46: this.url = new URL(url); Line 47: if (!this.url.getProtocol().equalsIgnoreCase("http") && !this.url.getProtocol().equalsIgnoreCase("https")) { > hmm... I like primitives if there is no actual value... and I do not want t Done Line 48: throw new RuntimeException("The URL " + url + " does not denote to an HTTP or HTTPS URL"); Line 49: } Line 50: } catch (MalformedURLException e) { Line 51: throw new IllegalArgumentException(url + " is not a valid URL"); Line 93: return this; Line 94: } Line 95: Line 96: public ConnectionBuilder appendRelativePath(URL url, String relativePath) throws MalformedURLException { Line 97: int port = url.getPort() == -1 ? url.getDefaultPort() : url.getPort(); > no need for port temp var Done Line 98: this.url = Line 99: new URL(url.getProtocol(), url.getHost(), port, new File(url.getFile(), relativePath).toString()); Line 100: return this; Line 101: } Line 95: Line 96: public ConnectionBuilder appendRelativePath(URL url, String relativePath) throws MalformedURLException { Line 97: int port = url.getPort() == -1 ? url.getDefaultPort() : url.getPort(); Line 98: this.url = Line 99: new URL(url.getProtocol(), url.getHost(), port, new File(url.getFile(), relativePath).toString()); > getPath? Done Line 100: return this; Line 101: } Line 102: Line 103: -- To view, visit http://gerrit.ovirt.org/33479 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I85ea4e7301b3a018b0438fff25cefad80ebd7256 Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Moti Asayag <masa...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches