Skip to content

Commit daf5c33

Browse files
author
Dahiya, Anil (A.)
committed
Changes for handling null inputs in some of the RPC Classes
1 parent 1ceb493 commit daf5c33

30 files changed

+154
-14
lines changed

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AddSubMenu.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public Integer getMenuID() {
6565
public void setMenuID( Integer menuID ) {
6666
if (menuID != null) {
6767
parameters.put(AddSubMenu.menuID, menuID );
68+
} else {
69+
parameters.remove(AddSubMenu.menuID);
6870
}
6971
}
7072
/**
@@ -99,6 +101,8 @@ public Integer getPosition() {
99101
public void setPosition( Integer position ) {
100102
if (position != null) {
101103
parameters.put(AddSubMenu.position, position );
104+
} else {
105+
parameters.remove(AddSubMenu.position);
102106
}
103107
}
104108
/**
@@ -118,6 +122,8 @@ public String getMenuName() {
118122
public void setMenuName( String menuName ) {
119123
if (menuName != null) {
120124
parameters.put(AddSubMenu.menuName, menuName );
125+
} else {
126+
parameters.remove(AddSubMenu.menuName);
121127
}
122128
}
123129
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/ButtonCapabilities.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public ButtonName getName() {
8686
public void setName( ButtonName name ) {
8787
if (name != null) {
8888
store.put(ButtonCapabilities.name, name );
89+
} else {
90+
store.remove(ButtonCapabilities.name);
8991
}
9092
}
9193
/**
@@ -102,6 +104,8 @@ public Boolean getShortPressAvailable() {
102104
public void setShortPressAvailable( Boolean shortPressAvailable ) {
103105
if (shortPressAvailable != null) {
104106
store.put(ButtonCapabilities.shortPressAvailable, shortPressAvailable );
107+
} else {
108+
store.remove(ButtonCapabilities.shortPressAvailable);
105109
}
106110
}
107111
/**
@@ -118,6 +122,8 @@ public Boolean getLongPressAvailable() {
118122
public void setLongPressAvailable( Boolean longPressAvailable ) {
119123
if (longPressAvailable != null) {
120124
store.put(ButtonCapabilities.longPressAvailable, longPressAvailable );
125+
} else {
126+
store.remove(ButtonCapabilities.longPressAvailable);
121127
}
122128
}
123129
/**
@@ -134,6 +140,8 @@ public Boolean getUpDownAvailable() {
134140
public void setUpDownAvailable( Boolean upDownAvailable ) {
135141
if (upDownAvailable != null) {
136142
store.put(ButtonCapabilities.upDownAvailable, upDownAvailable );
143+
} else {
144+
store.remove(ButtonCapabilities.upDownAvailable);
137145
}
138146
}
139147
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/Choice.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public Integer getChoiceID() {
8383
public void setChoiceID(Integer choiceID) {
8484
if (choiceID != null) {
8585
store.put(Choice.choiceID, choiceID);
86+
} else {
87+
store.remove(Choice.choiceID);
8688
}
8789
}
8890
/**
@@ -103,6 +105,8 @@ public String getMenuName() {
103105
public void setMenuName(String menuName) {
104106
if (menuName != null) {
105107
store.put(Choice.menuName, menuName);
108+
} else {
109+
store.remove(Choice.menuName);
106110
}
107111
}
108112
/**
@@ -130,6 +134,8 @@ public List<String> getVrCommands() {
130134
public void setVrCommands(List<String> vrCommands) {
131135
if (vrCommands != null) {
132136
store.put(Choice.vrCommands, vrCommands);
137+
} else {
138+
store.remove(Choice.vrCommands);
133139
}
134140
}
135141
/**

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/CreateInteractionChoiceSet.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public Integer getInteractionChoiceSetID() {
5959
public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
6060
if (interactionChoiceSetID != null) {
6161
parameters.put(CreateInteractionChoiceSet.interactionChoiceSetID, interactionChoiceSetID );
62+
} else {
63+
parameters.remove(CreateInteractionChoiceSet.interactionChoiceSetID);
6264
}
6365
}
6466
/**
@@ -97,6 +99,8 @@ public List<Choice> getChoiceSet() {
9799
public void setChoiceSet( List<Choice> choiceSet ) {
98100
if (choiceSet != null) {
99101
parameters.put(CreateInteractionChoiceSet.choiceSet, choiceSet );
102+
} else {
103+
parameters.remove(CreateInteractionChoiceSet.choiceSet);
100104
}
101105
}
102106
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public Integer getCmdID() {
5959
public void setCmdID( Integer cmdID ) {
6060
if (cmdID != null) {
6161
parameters.put(DeleteCommand.cmdID, cmdID );
62+
} else {
63+
parameters.remove(DeleteCommand.cmdID);
6264
}
6365
}
6466
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteInteractionChoiceSet.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public Integer getInteractionChoiceSetID() {
5555
public void setInteractionChoiceSetID( Integer interactionChoiceSetID ) {
5656
if (interactionChoiceSetID != null) {
5757
parameters.put(DeleteInteractionChoiceSet.interactionChoiceSetID, interactionChoiceSetID );
58+
} else {
59+
parameters.remove(DeleteInteractionChoiceSet.interactionChoiceSetID);
5860
}
5961
}
6062
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DeleteSubMenu.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public Integer getMenuID() {
4949
public void setMenuID( Integer menuID ) {
5050
if (menuID != null) {
5151
parameters.put(DeleteSubMenu.menuID, menuID );
52+
} else {
53+
parameters.remove(DeleteSubMenu.menuID);
5254
}
5355
}
5456
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public DisplayType getDisplayType() {
9494
public void setDisplayType( DisplayType displayType ) {
9595
if (displayType != null) {
9696
store.put(DisplayCapabilities.displayType, displayType );
97+
} else {
98+
store.remove(DisplayCapabilities.displayType);
9799
}
98100
}
99101
/**
@@ -127,6 +129,8 @@ public List<TextField> getTextFields() {
127129
public void setTextFields( List<TextField> textFields ) {
128130
if (textFields != null) {
129131
store.put(DisplayCapabilities.textFields, textFields );
132+
} else {
133+
store.remove(DisplayCapabilities.textFields);
130134
}
131135
}
132136

@@ -213,6 +217,8 @@ public List<MediaClockFormat> getMediaClockFormats() {
213217
public void setMediaClockFormats( List<MediaClockFormat> mediaClockFormats ) {
214218
if (mediaClockFormats != null) {
215219
store.put(DisplayCapabilities.mediaClockFormats, mediaClockFormats );
220+
} else {
221+
store.remove(DisplayCapabilities.mediaClockFormats);
216222
}
217223
}
218224

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/MenuParams.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public Integer getParentID() {
8484
public void setParentID( Integer parentID ) {
8585
if (parentID != null) {
8686
store.put(MenuParams.parentID, parentID );
87+
} else {
88+
store.remove(MenuParams.parentID);
8789
}
8890
}
8991
/**
@@ -114,6 +116,8 @@ public Integer getPosition() {
114116
public void setPosition( Integer position ) {
115117
if (position != null) {
116118
store.put(MenuParams.position, position );
119+
} else {
120+
store.remove(MenuParams.position);
117121
}
118122
}
119123
/**
@@ -140,6 +144,8 @@ public String getMenuName() {
140144
public void setMenuName( String menuName ) {
141145
if (menuName != null) {
142146
store.put(MenuParams.menuName, menuName );
147+
} else {
148+
store.remove(MenuParams.menuName);
143149
}
144150
}
145151
}

sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OnAppInterfaceUnregistered.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public AppInterfaceUnregisteredReason getReason() {
8181
public void setReason( AppInterfaceUnregisteredReason reason ) {
8282
if (reason != null) {
8383
parameters.put(OnAppInterfaceUnregistered.reason, reason );
84+
} else {
85+
parameters.remove(OnAppInterfaceUnregistered.reason);
8486
}
8587
}
8688
}

0 commit comments

Comments
 (0)