Skip to content

Commit b1edc68

Browse files
Simplify ternary condition in SCM
1 parent df73517 commit b1edc68

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

base/src/main/java/com/smartdevicelink/proxy/SystemCapabilityManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,9 @@ private void retrieveCapability(final SystemCapabilityType systemCapabilityType,
558558
- if subscribe is false, then shouldSubscribe = false
559559
- if subscribe is true and the HU supports subscriptions, then shouldSubscribe = true
560560
*/
561-
final boolean shouldSubscribe = ((subscribe != null) ? subscribe : isSubscribedToSystemCapability(systemCapabilityType)) && supportsSubscriptions();
562-
request.setSubscribe(shouldSubscribe);
561+
boolean shouldSubscribe = (subscribe != null) ? subscribe : isSubscribedToSystemCapability(systemCapabilityType);
562+
final boolean willSubscribe = shouldSubscribe && supportsSubscriptions();
563+
request.setSubscribe(willSubscribe);
563564
request.setOnRPCResponseListener(new OnRPCResponseListener() {
564565
@Override
565566
public void onResponse(int correlationId, RPCResponse response) {
@@ -578,7 +579,7 @@ public void onResponse(int correlationId, RPCResponse response) {
578579
}
579580
}
580581
if (supportsSubscriptions()) {
581-
systemCapabilitiesSubscriptionStatus.put(systemCapabilityType, shouldSubscribe);
582+
systemCapabilitiesSubscriptionStatus.put(systemCapabilityType, willSubscribe);
582583
}
583584
} else {
584585
if (scListener != null) {

0 commit comments

Comments
 (0)