Fix potential performance problems reported by findbugs 94/9794/2
authorRobert Varga <rovarga@cisco.com>
Thu, 7 Aug 2014 16:07:18 +0000 (18:07 +0200)
committerPrasanna Huddar <prasanna.k.huddar@gmail.com>
Fri, 8 Aug 2014 08:11:01 +0000 (08:11 +0000)
Reported things are inefficient number instatiantions, so this is very
safe.

Change-Id: If865d3748f79a046b3546249facc29968dd25d2d
Signed-off-by: Robert Varga <rovarga@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/ActionConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/FlowConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/GroupConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/MultipartReplyTranslator.java

index c1773eb06fdec856e40b206d7a09183742696f18..027203bc34813ef9945d6f6f35d0912ad462b914 100644 (file)
@@ -458,7 +458,7 @@ public final class ActionConvertor {
             matchEntriesBuilder.setOxmMatchField(VlanVid.class);
             VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();
             vlanVidBuilder.setCfiBit(true);
-            vlanVidBuilder.setVlanVid(new Integer(0x0000));
+            vlanVidBuilder.setVlanVid(0x0000);
             matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());
             matchEntriesBuilder.setHasMask(false);
             matchEntriesList.add(matchEntriesBuilder.build());
@@ -704,7 +704,7 @@ public final class ActionConvertor {
         if (outputAction.getMaxLength() != null) {
             maxLenActionBuilder.setMaxLength(outputAction.getMaxLength());
         } else {
-            maxLenActionBuilder.setMaxLength(new Integer(0));
+            maxLenActionBuilder.setMaxLength(0);
         }
         actionBuilder.addAugmentation(MaxLengthAction.class, maxLenActionBuilder.build());
 
index c70908023285ab024ff7ae1261c80a3e591b4e00..1ab6b6c34cd92c93151cbd7d4042f057791551d5 100644 (file)
@@ -64,9 +64,9 @@ public class FlowConvertor {
     // Default values for when things are null
     private static final BigInteger DEFAULT_COOKIE = BigInteger.ZERO;
     private static final BigInteger DEFAULT_COOKIE_MASK = BigInteger.ZERO;
-    private static final TableId DEFAULT_TABLE_ID = new TableId(new Long(0));
-    private static final Integer DEFAULT_IDLE_TIMEOUT = new Integer(5 * 60);
-    private static final Integer DEFAULT_HARD_TIMEOUT = new Integer(10 * 60);
+    private static final TableId DEFAULT_TABLE_ID = new TableId(0L);
+    private static final Integer DEFAULT_IDLE_TIMEOUT = 5 * 60;
+    private static final Integer DEFAULT_HARD_TIMEOUT = 10 * 60;
     private static final Integer DEFAULT_PRIORITY = Integer.parseInt("8000", 16);
     private static final Long DEFAULT_BUFFER_ID = Long.parseLong("ffffffff", 16);
     private static final Long OFPP_ANY = Long.parseLong("ffffffff", 16);
@@ -274,4 +274,4 @@ public class FlowConvertor {
         }
         return null;
     }
-}
\ No newline at end of file
+}
index 765363a8db4f7e49119db73cf9a14b4b464b0897..5647d16e4f8f28bb47347197ea5e22cf5d371c03 100644 (file)
@@ -41,7 +41,7 @@ public final class GroupConvertor {
     private static final Logger logger = LoggerFactory.getLogger(GroupConvertor.class);
     private static final String PREFIX_SEPARATOR = "/";
 
-    private static final  Integer DEFAULT_WEIGHT = new Integer(0);
+    private static final Integer DEFAULT_WEIGHT = 0;
     private static final Long OFPP_ANY = Long.parseLong("ffffffff", 16);
     private static final Long DEFAULT_WATCH_PORT = OFPP_ANY;
     private static final Long OFPG_ANY = Long.parseLong("ffffffff", 16);
index addc33a4616b254e9225565aee69aebe2c373868..6fe518e618bec719aadce41fb1b55467ae0d6948 100644 (file)
@@ -892,7 +892,7 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntries>> {
                     ipv6LabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(ipv6FlabelMatchEntry.getIpv6Flabel()));
                     MaskMatchEntry maskMatchEntry = ofMatch.getAugmentation(MaskMatchEntry.class);
                     if (maskMatchEntry != null) {
-                        ipv6LabelBuilder.setFlabelMask(new Ipv6FlowLabel(new Long(ByteUtil
+                        ipv6LabelBuilder.setFlabelMask(new Ipv6FlowLabel(Long.valueOf(ByteUtil
                                 .bytesToUnsignedInt(maskMatchEntry.getMask()))));
                     }
                     ipv6MatchBuilder.setIpv6Label(ipv6LabelBuilder.build());
index 1a430be7af38a61bbcfcb8616c01a844c37986f6..33c7fb55350878a20aa3f04c37688dc69708fd78 100644 (file)
@@ -487,7 +487,7 @@ public class MultipartReplyTranslator implements IMDMessageTranslator<OfHeader,
             supportActionBitmap |= supportedActions.isOFPATPUSHPBB()?(1 << 25): ~(1 << 25);
             supportActionBitmap |= supportedActions.isOFPATPOPPBB()?(1 << 26): ~(1 << 26);
             supportActionBitmap |= supportedActions.isOFPATEXPERIMENTER()?(1 << 27): ~(1 << 27);
-            supportActionByGroups.add(new Long(supportActionBitmap));
+            supportActionByGroups.add(Long.valueOf(supportActionBitmap));
         }
         return supportActionByGroups;
     }