From a61e04f0972208eb11f8cf3f9e1457db7409b4ed Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Tue, 8 Mar 2016 00:02:35 +0500 Subject: [PATCH] Fixing squid:S2293 - The diamond operator ("<>") should be used. --- src/main/java/com/cloudhopper/smpp/SmppConstants.java | 4 ++-- .../com/cloudhopper/smpp/impl/DefaultSmppSession.java | 4 ++-- .../cloudhopper/smpp/impl/PollableSmppSessionHandler.java | 8 ++++---- src/main/java/com/cloudhopper/smpp/pdu/Pdu.java | 2 +- .../smpp/simulator/SmppSimulatorServerHandler.java | 2 +- .../smpp/simulator/SmppSimulatorSessionHandler.java | 6 +++--- .../com/cloudhopper/smpp/ssl/CertificateValidator.java | 2 +- .../java/com/cloudhopper/smpp/ssl/SslConfiguration.java | 8 ++++---- .../java/com/cloudhopper/smpp/ssl/SslContextFactory.java | 4 ++-- .../smpp/util/ConcurrentCommandStatusCounter.java | 4 ++-- .../java/com/cloudhopper/smpp/util/DeliveryReceipt.java | 2 +- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/java/com/cloudhopper/smpp/SmppConstants.java b/src/main/java/com/cloudhopper/smpp/SmppConstants.java index 374a9ca5..55b10c93 100644 --- a/src/main/java/com/cloudhopper/smpp/SmppConstants.java +++ b/src/main/java/com/cloudhopper/smpp/SmppConstants.java @@ -521,7 +521,7 @@ public class SmppConstants { public static final Map TAG_NAME_MAP; static { - STATUS_MESSAGE_MAP = new HashMap(); + STATUS_MESSAGE_MAP = new HashMap<>(); STATUS_MESSAGE_MAP.put(STATUS_OK, "OK"); STATUS_MESSAGE_MAP.put(STATUS_INVMSGLEN, "Message length invalid"); STATUS_MESSAGE_MAP.put(STATUS_INVCMDLEN, "Command length invalid"); @@ -584,7 +584,7 @@ public class SmppConstants { STATUS_MESSAGE_MAP.put(STATUS_INVBCASTCNTTYPE, "Broadcast Content Type is invalid"); STATUS_MESSAGE_MAP.put(STATUS_INVBCASTMSGCLASS, "Broadcast Message Class is invalid"); - TAG_NAME_MAP = new HashMap(); + TAG_NAME_MAP = new HashMap<>(); TAG_NAME_MAP.put(TAG_SOURCE_TELEMATICS_ID, "source_telematics_id"); TAG_NAME_MAP.put(TAG_PAYLOAD_TYPE, "payload_type"); TAG_NAME_MAP.put(TAG_PRIVACY_INDICATOR, "privacy_indicator"); diff --git a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java index 66ff11b7..4ae163ca 100644 --- a/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java +++ b/src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java @@ -159,9 +159,9 @@ public DefaultSmppSession(Type localType, SmppSessionConfiguration configuration // different ways to construct the window if monitoring is enabled if (monitorExecutor != null && configuration.getWindowMonitorInterval() > 0) { // enable send window monitoring, verify if the monitoringInterval has been set - this.sendWindow = new Window(configuration.getWindowSize(), monitorExecutor, configuration.getWindowMonitorInterval(), this, configuration.getName() + ".Monitor"); + this.sendWindow = new Window<>(configuration.getWindowSize(), monitorExecutor, configuration.getWindowMonitorInterval(), this, configuration.getName() + ".Monitor"); } else { - this.sendWindow = new Window(configuration.getWindowSize()); + this.sendWindow = new Window<>(configuration.getWindowSize()); } // these server-only items are null diff --git a/src/main/java/com/cloudhopper/smpp/impl/PollableSmppSessionHandler.java b/src/main/java/com/cloudhopper/smpp/impl/PollableSmppSessionHandler.java index 18dab154..e1eb7d94 100644 --- a/src/main/java/com/cloudhopper/smpp/impl/PollableSmppSessionHandler.java +++ b/src/main/java/com/cloudhopper/smpp/impl/PollableSmppSessionHandler.java @@ -47,10 +47,10 @@ public class PollableSmppSessionHandler implements SmppSessionHandler { private final AtomicInteger closedCount; public PollableSmppSessionHandler() { - this.receivedPduRequests = new LinkedBlockingQueue(); - this.receivedExpectedPduResponses = new LinkedBlockingQueue(); - this.receivedUnexpectedPduResponses = new LinkedBlockingQueue(); - this.throwables = new LinkedBlockingQueue(); + this.receivedPduRequests = new LinkedBlockingQueue<>(); + this.receivedExpectedPduResponses = new LinkedBlockingQueue<>(); + this.receivedUnexpectedPduResponses = new LinkedBlockingQueue<>(); + this.throwables = new LinkedBlockingQueue<>(); this.closedCount = new AtomicInteger(); } diff --git a/src/main/java/com/cloudhopper/smpp/pdu/Pdu.java b/src/main/java/com/cloudhopper/smpp/pdu/Pdu.java index d7808070..ab9be05c 100644 --- a/src/main/java/com/cloudhopper/smpp/pdu/Pdu.java +++ b/src/main/java/com/cloudhopper/smpp/pdu/Pdu.java @@ -159,7 +159,7 @@ public ArrayList getOptionalParameters() { */ public void addOptionalParameter(Tlv tlv) { if (this.optionalParameters == null) { - this.optionalParameters = new ArrayList(); + this.optionalParameters = new ArrayList<>(); } this.optionalParameters.add(tlv); } diff --git a/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorServerHandler.java b/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorServerHandler.java index 4570a535..660bceaa 100644 --- a/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorServerHandler.java +++ b/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorServerHandler.java @@ -53,7 +53,7 @@ public class SmppSimulatorServerHandler extends SimpleChannelHandler { public SmppSimulatorServerHandler(ChannelGroup sessionChannels) { this.sessionChannels = sessionChannels; - this.sessionQueue = new LinkedBlockingQueue(); + this.sessionQueue = new LinkedBlockingQueue<>(); } public SmppSimulatorPduProcessor getDefaultPduProcessor() { diff --git a/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorSessionHandler.java b/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorSessionHandler.java index 7e5a4ad0..bfd995f1 100644 --- a/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorSessionHandler.java +++ b/src/main/java/com/cloudhopper/smpp/simulator/SmppSimulatorSessionHandler.java @@ -59,9 +59,9 @@ public class SmppSimulatorSessionHandler extends FrameDecoder { public SmppSimulatorSessionHandler(Channel channel, PduTranscoder transcoder) { this.channel = channel; this.transcoder = transcoder; - this.pduQueue = new LinkedBlockingQueue(); - this.exceptionQueue = new LinkedBlockingQueue(); - this.writePduQueue = new LinkedBlockingDeque(); + this.pduQueue = new LinkedBlockingQueue<>(); + this.exceptionQueue = new LinkedBlockingQueue<>(); + this.writePduQueue = new LinkedBlockingDeque<>(); } public SmppSimulatorPduProcessor getPduProcessor() { diff --git a/src/main/java/com/cloudhopper/smpp/ssl/CertificateValidator.java b/src/main/java/com/cloudhopper/smpp/ssl/CertificateValidator.java index 6dfc4194..c92cc8b3 100644 --- a/src/main/java/com/cloudhopper/smpp/ssl/CertificateValidator.java +++ b/src/main/java/com/cloudhopper/smpp/ssl/CertificateValidator.java @@ -168,7 +168,7 @@ public void validate(KeyStore keyStore, Certificate cert) throws CertificateExce public void validate(Certificate[] certChain) throws CertificateException { try { - ArrayList certList = new ArrayList(); + ArrayList certList = new ArrayList<>(); for (Certificate item : certChain) { if (item == null) continue; if (!(item instanceof X509Certificate)) { diff --git a/src/main/java/com/cloudhopper/smpp/ssl/SslConfiguration.java b/src/main/java/com/cloudhopper/smpp/ssl/SslConfiguration.java index 70f8f586..bf9bcd40 100644 --- a/src/main/java/com/cloudhopper/smpp/ssl/SslConfiguration.java +++ b/src/main/java/com/cloudhopper/smpp/ssl/SslConfiguration.java @@ -45,10 +45,10 @@ public class SslConfiguration (Security.getProperty("ssl.TrustManagerFactory.algorithm") == null ? "SunX509" : Security.getProperty("ssl.TrustManagerFactory.algorithm")); - private final Set excludeProtocols = new HashSet(); + private final Set excludeProtocols = new HashSet<>(); private Set includeProtocols = null; - private final Set excludeCipherSuites = new HashSet(); + private final Set excludeCipherSuites = new HashSet<>(); private Set includeCipherSuites = null; private String keyStorePath; @@ -127,7 +127,7 @@ public String[] getIncludeProtocols() { * {@link SSLEngine#setEnabledProtocols(String[])} */ public void setIncludeProtocols(String... protocols) { - this.includeProtocols = new HashSet(Arrays.asList(protocols)); + this.includeProtocols = new HashSet<>(Arrays.asList(protocols)); } /** @@ -169,7 +169,7 @@ public String[] getIncludeCipherSuites() { * {@link SSLEngine#setEnabledCipherSuites(String[])} */ public void setIncludeCipherSuites(String... cipherSuites) { - this.includeCipherSuites = new HashSet(Arrays.asList(cipherSuites)); + this.includeCipherSuites = new HashSet<>(Arrays.asList(cipherSuites)); } /** diff --git a/src/main/java/com/cloudhopper/smpp/ssl/SslContextFactory.java b/src/main/java/com/cloudhopper/smpp/ssl/SslContextFactory.java index 888da759..0f9b0b01 100644 --- a/src/main/java/com/cloudhopper/smpp/ssl/SslContextFactory.java +++ b/src/main/java/com/cloudhopper/smpp/ssl/SslContextFactory.java @@ -414,7 +414,7 @@ private static boolean contains(Object[] arr, Object obj) { * @return Array of cipher suites to enable */ public String[] selectProtocols(String[] enabledProtocols, String[] supportedProtocols) { - Set selected_protocols = new HashSet(); + Set selected_protocols = new HashSet<>(); // Set the starting protocols - either from the included or enabled list if (sslConfig.getIncludeProtocols() != null) { @@ -443,7 +443,7 @@ public String[] selectProtocols(String[] enabledProtocols, String[] supportedPro * @return Array of cipher suites to enable */ public String[] selectCipherSuites(String[] enabledCipherSuites, String[] supportedCipherSuites) { - Set selected_ciphers = new HashSet(); + Set selected_ciphers = new HashSet<>(); // Set the starting ciphers - either from the included or enabled list if (sslConfig.getIncludeCipherSuites() != null) { diff --git a/src/main/java/com/cloudhopper/smpp/util/ConcurrentCommandStatusCounter.java b/src/main/java/com/cloudhopper/smpp/util/ConcurrentCommandStatusCounter.java index c89f05c7..d6436c23 100644 --- a/src/main/java/com/cloudhopper/smpp/util/ConcurrentCommandStatusCounter.java +++ b/src/main/java/com/cloudhopper/smpp/util/ConcurrentCommandStatusCounter.java @@ -35,7 +35,7 @@ public class ConcurrentCommandStatusCounter { private ConcurrentHashMap map; public ConcurrentCommandStatusCounter() { - this.map = new ConcurrentHashMap(); + this.map = new ConcurrentHashMap<>(); } public void reset() { @@ -71,7 +71,7 @@ public int incrementAndGet(int commandStatus) { } public SortedMap createSortedMapSnapshot() { - SortedMap sortedMap = new TreeMap(); + SortedMap sortedMap = new TreeMap<>(); for (Map.Entry entry : this.map.entrySet()) { sortedMap.put(entry.getKey(), new Integer(entry.getValue().get())); } diff --git a/src/main/java/com/cloudhopper/smpp/util/DeliveryReceipt.java b/src/main/java/com/cloudhopper/smpp/util/DeliveryReceipt.java index a0e2f10c..fbea8b17 100644 --- a/src/main/java/com/cloudhopper/smpp/util/DeliveryReceipt.java +++ b/src/main/java/com/cloudhopper/smpp/util/DeliveryReceipt.java @@ -368,7 +368,7 @@ static public DeliveryReceipt parseShortMessage(String shortMessage, // create a new DLR with fields set to "uninitialized" values DeliveryReceipt dlr = new DeliveryReceipt(null, -1, -1, null, null, (byte) -1, -1, null); - TreeMap fieldsByStartPos = new TreeMap(); + TreeMap fieldsByStartPos = new TreeMap<>(); // find location of all possible fields in text of message and add to // treemap by their startPos so that we'll end up with an ordered list