Skip to content

Commit 8ff2215

Browse files
Fix remaining SpotBugs UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR violations.
Addressed missed null checks in: - RequestBuilder.java: Added null checks for response and list. - DateSpinner.java: Added null check for day field. This builds upon previous fixes to enforce the rule in CI.
1 parent 104d2ea commit 8ff2215

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CodenameOne/src/com/codename1/io/rest/RequestBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,13 @@ public Response<List<PropertyBusinessObject>> getAsPropertyList(Class type, Stri
837837
CN.addToQueueAndWait(request);
838838
Map response = ((Connection) request).json;
839839
try {
840+
if (response == null) {
841+
return null;
842+
}
840843
List<Map> lst = (List<Map>) response.get(root);
844+
if (lst == null) {
845+
return null;
846+
}
841847
List<PropertyBusinessObject> result = new ArrayList<PropertyBusinessObject>();
842848
for (Map m : lst) {
843849
PropertyBusinessObject pb = (PropertyBusinessObject) type.newInstance();

CodenameOne/src/com/codename1/ui/spinner/DateSpinner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void setCurrentYear(int currentYear) {
172172
* @return the currentDay
173173
*/
174174
public int getCurrentDay() {
175-
if(day.getValue() == null) {
175+
if(day == null || day.getValue() == null) {
176176
return 1;
177177
}
178178
return ((Integer) day.getValue()).intValue();

0 commit comments

Comments
 (0)