summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
Diffstat (limited to 'base')
-rw-r--r--base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java10
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java50
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java2
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java16
-rw-r--r--base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java3
6 files changed, 41 insertions, 42 deletions
diff --git a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
index e7947e259..b64db24ba 100644
--- a/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
+++ b/base/src/main/java/com/smartdevicelink/managers/lifecycle/BaseLifecycleManager.java
@@ -1003,6 +1003,7 @@ abstract class BaseLifecycleManager {
return BaseLifecycleManager.this.session.isTransportForServiceAvailable(serviceType);
}
+ @NonNull
@Override
public SdlMsgVersion getSdlMsgVersion() {
SdlMsgVersion msgVersion = new SdlMsgVersion(rpcSpecVersion.getMajor(), rpcSpecVersion.getMinor());
@@ -1010,6 +1011,7 @@ abstract class BaseLifecycleManager {
return msgVersion;
}
+ @NonNull
@Override
public Version getProtocolVersion() {
return BaseLifecycleManager.this.getProtocolVersion();
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
index 427379842..fd80c6cca 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCMessage.java
@@ -47,8 +47,8 @@ public class RPCMessage extends RPCStruct {
this(functionName, "request");
}
- protected RPCMessage(RPCMessage rpcm) {
- this(cloneStore(rpcm));
+ protected RPCMessage(RPCMessage rpcMessage) {
+ this(cloneStore(rpcMessage));
}
protected RPCMessage(RPCStruct rpcs) {
@@ -57,8 +57,8 @@ public class RPCMessage extends RPCStruct {
}
public RPCMessage(String functionName, String messageType) {
- function = new Hashtable<String, Object>();
- parameters = new Hashtable<String, Object>();
+ function = new Hashtable<>();
+ parameters = new Hashtable<>();
this.messageType = messageType;
function.put(KEY_PARAMETERS, parameters);
@@ -94,7 +94,7 @@ public class RPCMessage extends RPCStruct {
protected String messageType;
protected Hashtable<String, Object> parameters;
- protected Hashtable<String, Object> function;
+ protected final Hashtable<String, Object> function;
public String getFunctionName() {
return (String)function.get(KEY_FUNCTION_NAME);
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java b/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
index dd8388142..dfcd283a6 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCNotification.java
@@ -29,29 +29,29 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-package com.smartdevicelink.proxy;
-
-import java.util.Hashtable;
-
-public class RPCNotification extends RPCMessage {
-
- public RPCNotification(String functionName) {
- super(functionName, RPCMessage.KEY_NOTIFICATION);
- }
-
- public RPCNotification(Hashtable<String, Object> hash) {
- super(hash);
- }
-
- public RPCNotification(RPCMessage rpcMsg) {
- super(preprocessMsg(rpcMsg));
- }
-
- static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
- if (rpcMsg.getMessageType() != RPCMessage.KEY_NOTIFICATION) {
- rpcMsg.messageType = RPCMessage.KEY_NOTIFICATION;
- }
-
- return rpcMsg;
- }
+package com.smartdevicelink.proxy;
+
+import java.util.Hashtable;
+
+public class RPCNotification extends RPCMessage {
+
+ public RPCNotification(String functionName) {
+ super(functionName, RPCMessage.KEY_NOTIFICATION);
+ }
+
+ public RPCNotification(Hashtable<String, Object> hash) {
+ super(hash);
+ }
+
+ public RPCNotification(RPCMessage rpcMsg) {
+ super(preprocessMsg(rpcMsg));
+ }
+
+ static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
+ if (!RPCMessage.KEY_NOTIFICATION.equals(rpcMsg.getMessageType())) {
+ rpcMsg.messageType = RPCMessage.KEY_NOTIFICATION;
+ }
+
+ return rpcMsg;
+ }
} \ No newline at end of file
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java b/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
index b0a3549dc..dd56b370f 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCResponse.java
@@ -100,7 +100,7 @@ public class RPCResponse extends RPCMessage {
}
static RPCMessage preprocessMsg (RPCMessage rpcMsg) {
- if (rpcMsg.getMessageType() != RPCMessage.KEY_RESPONSE) {
+ if (!RPCMessage.KEY_RESPONSE.equals(rpcMsg.getMessageType())) {
rpcMsg.messageType = RPCMessage.KEY_RESPONSE;
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
index e54694526..c8a0443d7 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/RPCStruct.java
@@ -57,7 +57,7 @@ public class RPCStruct {
private Version rpcSpecVersion = null;
- protected Hashtable<String, Object> store = null;
+ protected Hashtable<String, Object> store;
public boolean getStoreValue(String key) { // for unit testing
return store.contains(key);
@@ -68,7 +68,7 @@ public class RPCStruct {
}
public RPCStruct() {
- store = new Hashtable<String, Object>();
+ store = new Hashtable<>();
}
protected RPCStruct(RPCStruct rpcs) {
@@ -150,9 +150,9 @@ public class RPCStruct {
}
/**
- * Cycles through parameters in this RPC to ensure they all get formated
+ * Cycles through parameters in this RPC to ensure they all get formatted
* @param rpcVersion version of the rpc spec that should be used to format this rpc
- * @param value the object to investigate if it needs to be formated
+ * @param value the object to investigate if it needs to be formatted
*/
private void internalFormat(Version rpcVersion, Object value) {
if(value instanceof RPCStruct) {
@@ -284,7 +284,7 @@ public class RPCStruct {
} else if (tClass.isInstance(item)) {
return list;
} else if (item instanceof Hashtable) {
- List<Object> newList = new ArrayList<Object>();
+ List<Object> newList = new ArrayList<>();
Object customObject;
for (Object hashObj : list) {
try {
@@ -303,7 +303,7 @@ public class RPCStruct {
}
return newList;
} else if (item instanceof String){
- List<Object> newList = new ArrayList<Object>();
+ List<Object> newList = new ArrayList<>();
for (Object hashObj : list) {
Object toAdd = getValueForString(tClass, (String) hashObj);
if (toAdd != null) {
@@ -336,9 +336,7 @@ public class RPCStruct {
if(valueForString != null){
try {
return valueForString.invoke(null, (String) s);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
+ } catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
diff --git a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
index d8a70b062..c5dc66403 100644
--- a/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
+++ b/base/src/main/java/com/smartdevicelink/proxy/interfaces/ISdl.java
@@ -54,7 +54,6 @@ import java.util.List;
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-@SuppressWarnings("unused")
public interface ISdl {
/**
@@ -89,7 +88,7 @@ public interface ISdl {
/**
* Starts the video streaming service
- * @param parameters desired video streaming params for this sevice to be started with
+ * @param parameters desired video streaming params for this service to be started with
* @param encrypted flag to start this service with encryption or not
*/
void startVideoService(VideoStreamingParameters parameters, boolean encrypted);