Shahar Havivi has uploaded a new change for review. Change subject: findbugs: inefficient use of String constructor ......................................................................
findbugs: inefficient use of String constructor Using the java.lang.String(String) constructor wastes memory because the object so constructed will be functionally indistinguishable from the String passed as a parameter. Use the argument String directly. findbugs reason: Dm: Method invokes inefficient new String(String) constructor (DM_STRING_CTOR) Change-Id: I96b98c508f2ca60daed60be6ec29db35c2016bb3 Signed-off-by: Shahar Havivi <shav...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UriAuthority.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/UrlValidation.java 3 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/77/15277/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java index 2f36daf..4e82a65 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/Uri.java @@ -25,7 +25,7 @@ private String path; public Uri(String uri) { - MatchResult matcher = PATTERN_URI.exec(uri == null ? new String() : uri); + MatchResult matcher = PATTERN_URI.exec(uri == null ? "" : uri); valid = matcher != null; if (valid) { setScheme(matcher.getGroup(1)); @@ -39,7 +39,7 @@ return null; } - String uri = new String(); + String uri = ""; if (!scheme.isEmpty()) { uri += scheme + "://"; //$NON-NLS-1$ } @@ -57,7 +57,7 @@ } public void setScheme(String scheme) { - this.scheme = (scheme == null) ? new String() : scheme; + this.scheme = (scheme == null) ? "" : scheme; } public UriAuthority getAuthority() { @@ -76,7 +76,7 @@ } public void setPath(String path) { - this.path = (path == null) ? new String() : path; + this.path = (path == null) ? "" : path; } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UriAuthority.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UriAuthority.java index a9b64d5..0a97118 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UriAuthority.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/UriAuthority.java @@ -18,7 +18,7 @@ private String port; public UriAuthority(String authority) { - MatchResult matcher = PATTERN_AUTHORITY.exec(authority == null ? new String() : authority); + MatchResult matcher = PATTERN_AUTHORITY.exec(authority == null ? "" : authority); valid = matcher != null; if (valid) { setHost(matcher.getGroup(1)); @@ -31,7 +31,7 @@ return null; } - String authority = new String(); + String authority = ""; authority += host; if (!port.isEmpty()) { authority += ':' + port; @@ -48,7 +48,7 @@ } public void setHost(String host) { - this.host = (host == null) ? new String() : host; + this.host = (host == null) ? "" : host; } public String getPort() { @@ -56,7 +56,7 @@ } public void setPort(String port) { - this.port = (port == null) ? new String() : port; + this.port = (port == null) ? "" : port; } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/UrlValidation.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/UrlValidation.java index f3be3f6..b2723c1 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/UrlValidation.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/validation/UrlValidation.java @@ -12,7 +12,7 @@ public UrlValidation(String[] allowedSchemes) { if (allowedSchemes == null) { - this.allowedSchemes.add(new String()); + this.allowedSchemes.add(""); } else { for (String scheme : allowedSchemes) { this.allowedSchemes.add(scheme.toLowerCase()); -- To view, visit http://gerrit.ovirt.org/15277 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I96b98c508f2ca60daed60be6ec29db35c2016bb3 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Shahar Havivi <shav...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches