From 5399cb6877621d3c199d1c44efa1cab343725f9b Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Wed, 27 Aug 2014 10:16:34 -0700 Subject: [PATCH] Avoid unnecessary boxing Found with FindBugs. --- .../jclouds/cloudsigma/functions/MapToDriveInfo.java | 12 ++++++------ .../cloudsigma/functions/MapToDriveMetrics.java | 8 ++++---- .../cloudsigma/functions/MapToServerInfo.java | 4 ++-- .../cloudsigma/functions/MapToServerMetrics.java | 8 ++++---- .../jclouds/cloudwatch/xml/MetricAlarmHandler.java | 4 ++-- .../elasticstack/functions/MapToDriveInfo.java | 10 +++++----- .../elasticstack/functions/MapToDriveMetrics.java | 8 ++++---- .../elasticstack/functions/MapToServerInfo.java | 6 +++--- .../elasticstack/functions/MapToServerMetrics.java | 8 ++++---- .../elasticstack/functions/MapToStandardDrive.java | 4 ++-- .../v1/functions/SubdomainsToPagedIterable.java | 2 +- .../cloudloadbalancers/v1/functions/ParseNodes.java | 2 +- .../functions/ParseContainerMetadataFromHeaders.java | 4 ++-- .../swift/options/ListContainerOptions.java | 2 +- .../org/jclouds/compute/functions/Sha512Crypt.java | 2 +- core/src/main/java/org/jclouds/JcloudsVersion.java | 6 +++--- .../strategy/GoGridComputeServiceAdapter.java | 10 +++++----- 17 files changed, 50 insertions(+), 50 deletions(-) diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveInfo.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveInfo.java index ef5fc58793..9744bc30f5 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveInfo.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveInfo.java @@ -63,7 +63,7 @@ public class MapToDriveInfo implements Function, DriveInfo> if (from.containsKey("readers")) builder.readers(Splitter.on(' ').split(from.get("readers"))); if (from.containsKey("size")) - builder.size(Long.valueOf(from.get("size"))); + builder.size(Long.parseLong(from.get("size"))); Map metadata = Maps.newLinkedHashMap(); for (Entry entry : from.entrySet()) { if (entry.getKey().startsWith("user:")) @@ -72,7 +72,7 @@ public class MapToDriveInfo implements Function, DriveInfo> if (from.containsKey("use")) builder.use(Splitter.on(' ').split(from.get("use"))); if (from.containsKey("bits")) - builder.bits(Integer.valueOf(from.get("bits"))); + builder.bits(Integer.parseInt(from.get("bits"))); if (from.containsKey("url")) builder.url(URI.create(from.get("url"))); builder.encryptionKey(from.get("encryption:key")); @@ -98,13 +98,13 @@ public class MapToDriveInfo implements Function, DriveInfo> protected DriveMetrics buildMetrics(Map from) { DriveMetrics.Builder metricsBuilder = new DriveMetrics.Builder(); if (from.containsKey("read:bytes")) - metricsBuilder.readBytes(Long.valueOf(from.get("read:bytes"))); + metricsBuilder.readBytes(Long.parseLong(from.get("read:bytes"))); if (from.containsKey("read:requests")) - metricsBuilder.readRequests(Long.valueOf(from.get("read:requests"))); + metricsBuilder.readRequests(Long.parseLong(from.get("read:requests"))); if (from.containsKey("write:bytes")) - metricsBuilder.writeBytes(Long.valueOf(from.get("write:bytes"))); + metricsBuilder.writeBytes(Long.parseLong(from.get("write:bytes"))); if (from.containsKey("write:requests")) - metricsBuilder.writeRequests(Long.valueOf(from.get("write:requests"))); + metricsBuilder.writeRequests(Long.parseLong(from.get("write:requests"))); return metricsBuilder.build(); } } diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java index 8d24e11ce0..c5aef9d807 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToDriveMetrics.java @@ -68,13 +68,13 @@ public class MapToDriveMetrics implements Function, Map from) { DriveMetrics.Builder builder = new DriveMetrics.Builder(); if (from.containsKey(key + ":read:bytes")) - builder.readBytes(Long.valueOf(from.get(key + ":read:bytes"))); + builder.readBytes(Long.parseLong(from.get(key + ":read:bytes"))); if (from.containsKey(key + ":read:requests")) - builder.readRequests(Long.valueOf(from.get(key + ":read:requests"))); + builder.readRequests(Long.parseLong(from.get(key + ":read:requests"))); if (from.containsKey(key + ":write:bytes")) - builder.writeBytes(Long.valueOf(from.get(key + ":write:bytes"))); + builder.writeBytes(Long.parseLong(from.get(key + ":write:bytes"))); if (from.containsKey(key + ":write:requests")) - builder.writeRequests(Long.valueOf(from.get(key + ":write:requests"))); + builder.writeRequests(Long.parseLong(from.get(key + ":write:requests"))); return builder.build(); } } diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerInfo.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerInfo.java index 245e011d01..6a493d020e 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerInfo.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerInfo.java @@ -62,12 +62,12 @@ public class MapToServerInfo implements Function, ServerInfo if (from.containsKey("status")) builder.status(ServerStatus.fromValue(from.get("status"))); if (from.containsKey("smp") && !"auto".equals(from.get("smp"))) - builder.smp(Integer.valueOf(from.get("smp"))); + builder.smp(Integer.parseInt(from.get("smp"))); builder.cpu(Integer.parseInt(from.get("cpu"))); builder.mem(Integer.parseInt(from.get("mem"))); builder.user(from.get("user")); if (from.containsKey("started")) - builder.started(new Date(Long.valueOf(from.get("started")))); + builder.started(new Date(Long.parseLong(from.get("started")))); builder.uuid(from.get("server")); builder.vnc(new VNC(from.get("vnc:ip"), from.get("vnc:password"), from.containsKey("vnc:tls") && Boolean.valueOf(from.get("vnc:tls")))); diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerMetrics.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerMetrics.java index 904460f6bf..3138b0e56c 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerMetrics.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/functions/MapToServerMetrics.java @@ -38,13 +38,13 @@ public class MapToServerMetrics implements Function, ServerM public ServerMetrics apply(Map from) { ServerMetrics.Builder metricsBuilder = new ServerMetrics.Builder(); if (from.containsKey("tx:packets")) - metricsBuilder.txPackets(Long.valueOf(from.get("tx:packets"))); + metricsBuilder.txPackets(Long.parseLong(from.get("tx:packets"))); if (from.containsKey("tx")) - metricsBuilder.tx(Long.valueOf(from.get("tx"))); + metricsBuilder.tx(Long.parseLong(from.get("tx"))); if (from.containsKey("rx:packets")) - metricsBuilder.rxPackets(Long.valueOf(from.get("rx:packets"))); + metricsBuilder.rxPackets(Long.parseLong(from.get("rx:packets"))); if (from.containsKey("rx")) - metricsBuilder.rx(Long.valueOf(from.get("rx"))); + metricsBuilder.rx(Long.parseLong(from.get("rx"))); metricsBuilder.driveMetrics(mapToDriveMetrics.apply(from)); ServerMetrics metrics = metricsBuilder.build(); diff --git a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/xml/MetricAlarmHandler.java b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/xml/MetricAlarmHandler.java index b76ea00232..10e3d6eeae 100644 --- a/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/xml/MetricAlarmHandler.java +++ b/apis/cloudwatch/src/main/java/org/jclouds/cloudwatch/xml/MetricAlarmHandler.java @@ -138,13 +138,13 @@ public class MetricAlarmHandler extends ParseSax.HandlerForGeneratedRequestWithR } else if (qName.equals("ComparisonOperator")) { comparisonOperator = ComparisonOperator.fromValue(SaxUtils.currentOrNull(currentText)); } else if (qName.equals("EvaluationPeriods")) { - evaluationPeriods = Integer.valueOf(SaxUtils.currentOrNull(currentText)); + evaluationPeriods = Integer.parseInt(SaxUtils.currentOrNull(currentText)); } else if (qName.equals("MetricName")) { metricName = SaxUtils.currentOrNull(currentText); } else if (qName.equals("Namespace")) { namespace = SaxUtils.currentOrNull(currentText); } else if (qName.equals("Period")) { - period = Integer.valueOf(SaxUtils.currentOrNull(currentText)); + period = Integer.parseInt(SaxUtils.currentOrNull(currentText)); } else if (qName.equals("StateReason")) { stateReason = SaxUtils.currentOrNull(currentText); } else if (qName.equals("StateReasonData")) { diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveInfo.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveInfo.java index c8bebb5eba..d31b4244d8 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveInfo.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveInfo.java @@ -59,7 +59,7 @@ public class MapToDriveInfo implements Function, DriveInfo> if (from.containsKey("readers")) builder.readers(Splitter.on(' ').split(from.get("readers"))); if (from.containsKey("size")) - builder.size(Long.valueOf(from.get("size"))); + builder.size(Long.parseLong(from.get("size"))); Map metadata = Maps.newLinkedHashMap(); for (Entry entry : from.entrySet()) { if (entry.getKey().startsWith("user:")) @@ -77,13 +77,13 @@ public class MapToDriveInfo implements Function, DriveInfo> protected DriveMetrics buildMetrics(Map from) { DriveMetrics.Builder metricsBuilder = new DriveMetrics.Builder(); if (from.containsKey("read:bytes")) - metricsBuilder.readBytes(Long.valueOf(from.get("read:bytes"))); + metricsBuilder.readBytes(Long.parseLong(from.get("read:bytes"))); if (from.containsKey("read:requests")) - metricsBuilder.readRequests(Long.valueOf(from.get("read:requests"))); + metricsBuilder.readRequests(Long.parseLong(from.get("read:requests"))); if (from.containsKey("write:bytes")) - metricsBuilder.writeBytes(Long.valueOf(from.get("write:bytes"))); + metricsBuilder.writeBytes(Long.parseLong(from.get("write:bytes"))); if (from.containsKey("write:requests")) - metricsBuilder.writeRequests(Long.valueOf(from.get("write:requests"))); + metricsBuilder.writeRequests(Long.parseLong(from.get("write:requests"))); return metricsBuilder.build(); } } diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveMetrics.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveMetrics.java index 9c96d4f99c..0bd7b22452 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveMetrics.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToDriveMetrics.java @@ -68,13 +68,13 @@ public class MapToDriveMetrics implements Function, Map from) { DriveMetrics.Builder builder = new DriveMetrics.Builder(); if (from.containsKey(key + ":read:bytes")) - builder.readBytes(Long.valueOf(from.get(key + ":read:bytes"))); + builder.readBytes(Long.parseLong(from.get(key + ":read:bytes"))); if (from.containsKey(key + ":read:requests")) - builder.readRequests(Long.valueOf(from.get(key + ":read:requests"))); + builder.readRequests(Long.parseLong(from.get(key + ":read:requests"))); if (from.containsKey(key + ":write:bytes")) - builder.writeBytes(Long.valueOf(from.get(key + ":write:bytes"))); + builder.writeBytes(Long.parseLong(from.get(key + ":write:bytes"))); if (from.containsKey(key + ":write:requests")) - builder.writeRequests(Long.valueOf(from.get(key + ":write:requests"))); + builder.writeRequests(Long.parseLong(from.get(key + ":write:requests"))); return builder.build(); } } diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java index 2743a6ad10..12ffb9dbf6 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerInfo.java @@ -63,16 +63,16 @@ public class MapToServerInfo implements Function, ServerInfo if (from.containsKey("smp:cores")) { - builder.smp(Integer.valueOf(from.get("smp:cores"))); + builder.smp(Integer.parseInt(from.get("smp:cores"))); } else if (from.containsKey("smp") && !"auto".equals(from.get("smp"))) { - builder.smp(Integer.valueOf(from.get("smp"))); + builder.smp(Integer.parseInt(from.get("smp"))); } builder.cpu(Integer.parseInt(from.get("cpu"))); builder.mem(Integer.parseInt(from.get("mem"))); builder.user(from.get("user")); if (from.containsKey("started")) - builder.started(new Date(Long.valueOf(from.get("started")))); + builder.started(new Date(Long.parseLong(from.get("started")))); builder.uuid(from.get("server")); if (from.containsKey("boot")) builder.bootDeviceIds(Splitter.on(' ').split(from.get("boot"))); diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerMetrics.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerMetrics.java index d8bc9c7f70..a70959d9fc 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerMetrics.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToServerMetrics.java @@ -38,13 +38,13 @@ public class MapToServerMetrics implements Function, ServerM public ServerMetrics apply(Map from) { ServerMetrics.Builder metricsBuilder = new ServerMetrics.Builder(); if (from.containsKey("tx:packets")) - metricsBuilder.txPackets(Long.valueOf(from.get("tx:packets"))); + metricsBuilder.txPackets(Long.parseLong(from.get("tx:packets"))); if (from.containsKey("tx")) - metricsBuilder.tx(Long.valueOf(from.get("tx"))); + metricsBuilder.tx(Long.parseLong(from.get("tx"))); if (from.containsKey("rx:packets")) - metricsBuilder.rxPackets(Long.valueOf(from.get("rx:packets"))); + metricsBuilder.rxPackets(Long.parseLong(from.get("rx:packets"))); if (from.containsKey("rx")) - metricsBuilder.rx(Long.valueOf(from.get("rx"))); + metricsBuilder.rx(Long.parseLong(from.get("rx"))); metricsBuilder.driveMetrics(mapToDriveMetrics.apply(from)); ServerMetrics metrics = metricsBuilder.build(); diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToStandardDrive.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToStandardDrive.java index 5bfee0a60c..7732b0b571 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToStandardDrive.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/functions/MapToStandardDrive.java @@ -53,9 +53,9 @@ public class MapToStandardDrive implements Function, Standar if (from.containsKey("readers")) builder.readers(Splitter.on(' ').split(from.get("readers"))); if (from.containsKey("size")) - builder.size(Long.valueOf(from.get("size"))); + builder.size(Long.parseLong(from.get("size"))); if (from.containsKey("rawsize")) - builder.rawSize(Long.valueOf(from.get("rawsize"))); + builder.rawSize(Long.parseLong(from.get("rawsize"))); if (from.containsKey("format")) builder.format(ImageConversionType.fromValue(from.get("format"))); Map metadata = Maps.newLinkedHashMap(); diff --git a/apis/rackspace-clouddns/src/main/java/org/jclouds/rackspace/clouddns/v1/functions/SubdomainsToPagedIterable.java b/apis/rackspace-clouddns/src/main/java/org/jclouds/rackspace/clouddns/v1/functions/SubdomainsToPagedIterable.java index a6fd33555b..874cf6299e 100644 --- a/apis/rackspace-clouddns/src/main/java/org/jclouds/rackspace/clouddns/v1/functions/SubdomainsToPagedIterable.java +++ b/apis/rackspace-clouddns/src/main/java/org/jclouds/rackspace/clouddns/v1/functions/SubdomainsToPagedIterable.java @@ -44,7 +44,7 @@ public class SubdomainsToPagedIterable extends Arg0ToPagedIterable> markerToNextForArg0(Optional domainId) { - return new ListSubdomainsUnderDomainIdAtMarker(api, Integer.valueOf(domainId.get().toString())); + return new ListSubdomainsUnderDomainIdAtMarker(api, Integer.parseInt(domainId.get().toString())); } private static class ListSubdomainsUnderDomainIdAtMarker implements Function> { diff --git a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/functions/ParseNodes.java b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/functions/ParseNodes.java index 68a586bd74..2d0359a346 100644 --- a/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/functions/ParseNodes.java +++ b/apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/functions/ParseNodes.java @@ -77,7 +77,7 @@ public class ParseNodes extends ParseJson { int lastSlash = path.lastIndexOf('/'); int secondLastSlash = path.lastIndexOf('/', lastSlash - 1); - lbId = Integer.valueOf(path.substring(secondLastSlash + 1, lastSlash)); + lbId = Integer.parseInt(path.substring(secondLastSlash + 1, lastSlash)); return super.setContext(request); } diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java index 6581b3fa7a..27adb021bb 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/functions/ParseContainerMetadataFromHeaders.java @@ -43,8 +43,8 @@ public class ParseContainerMetadataFromHeaders implements Function