Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid nullpointers in list-typed fields #4

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Data
Expand All @@ -30,9 +31,8 @@
@NoArgsConstructor
public class AnalyticsRequest {

private List<Booking> bookings;
private List<Rule> customRules;
private List<Booking> bookings = new ArrayList<>();
private List<Rule> customRules = new ArrayList<>();
private GroupConfig groupConfig;
private List<String> contractBlackListMatcher;

private List<String> contractBlackListMatcher = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public class AnalyticsResult {

private RulesStatus rulesStatus;
private List<WrappedBooking> bookings = new ArrayList<>();
private List<BookingGroup> bookingGroups;
private List<BookingGroup> bookingGroups = new ArrayList<>();

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Data
Expand All @@ -35,7 +36,7 @@ public class BookingGroup {

protected Cycle cycle;
private BigDecimal amount;
private List<BookingPeriod> bookingPeriods;
private List<BookingPeriod> bookingPeriods = new ArrayList<>();

private String mainCategory;
private String subCategory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Data
Expand All @@ -14,5 +15,5 @@ public class BookingPeriod {
private LocalDate start;
private LocalDate end;
private BigDecimal amount;
private List<ExecutedBooking> bookings;
private List<ExecutedBooking> bookings = new ArrayList<>();
}
6 changes: 4 additions & 2 deletions src/main/java/de/adorsys/smartanalytics/api/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
Expand All @@ -35,7 +36,8 @@ public enum Type {

private String name;
private Type type;
private List<String> whitelistMatcher;
private List<String> blacklistMatcher;

private List<String> whitelistMatcher = new ArrayList<>();
private List<String> blacklistMatcher = new ArrayList<>();

}
5 changes: 3 additions & 2 deletions src/main/java/de/adorsys/smartanalytics/api/GroupConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
Expand All @@ -13,7 +14,7 @@
@NoArgsConstructor
public class GroupConfig {

private List<Group> groups;
private List<String> recurrentWhiteListMatcher;
private List<Group> groups = new ArrayList<>();
private List<String> recurrentWhiteListMatcher = new ArrayList<>();

}
3 changes: 2 additions & 1 deletion src/main/java/de/adorsys/smartanalytics/api/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
Expand All @@ -42,7 +43,7 @@ public enum SIMILARITY_MATCH_TYPE {
private String homepage;
private String email;

private Map<String, String> custom;
private Map<String, String> custom = new HashMap<>();

private boolean stop;
private boolean incoming;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
Expand All @@ -42,7 +43,7 @@ public class WrappedBooking implements Cloneable {
private String homepage;
private String hotline;
private String email;
private Map<String, String> custom;
private Map<String, String> custom = new HashMap<>();
private Set<String> usedRules = new HashSet<>();
// *****************************************

Expand Down