Skip to content

Commit 9e8f2c0

Browse files
authored
Merge pull request #120 from marcinar/master
Really allow zero interval + fix integer comparisons
2 parents ecaceb4 + 5ff8256 commit 9e8f2c0

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/BootNotificationConfirmation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public Integer getInterval() {
122122
*/
123123
@XmlElement
124124
public void setInterval(Integer interval) {
125-
if (interval <= 0) {
125+
if (interval < 0) {
126126
throw new PropertyConstraintException(interval, "interval be a positive value");
127127
}
128128

@@ -172,7 +172,7 @@ public boolean equals(Object o) {
172172
if (this == o) return true;
173173
if (o == null || getClass() != o.getClass()) return false;
174174
BootNotificationConfirmation that = (BootNotificationConfirmation) o;
175-
return interval == that.interval
175+
return Objects.equals(interval, that.interval)
176176
&& Objects.equals(currentTime, that.currentTime)
177177
&& status == that.status;
178178
}

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/ChangeAvailabilityRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public boolean equals(Object o) {
131131
if (this == o) return true;
132132
if (o == null || getClass() != o.getClass()) return false;
133133
ChangeAvailabilityRequest that = (ChangeAvailabilityRequest) o;
134-
return connectorId == that.connectorId && type == that.type;
134+
return Objects.equals(connectorId, that.connectorId) && type == that.type;
135135
}
136136

137137
@Override

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/core/MeterValuesRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ public boolean equals(Object o) {
148148
if (this == o) return true;
149149
if (o == null || getClass() != o.getClass()) return false;
150150
MeterValuesRequest that = (MeterValuesRequest) o;
151-
return connectorId == that.connectorId
152-
&& transactionId == that.transactionId
151+
return Objects.equals(connectorId, that.connectorId)
152+
&& Objects.equals(transactionId, that.transactionId)
153153
&& Arrays.equals(meterValue, that.meterValue);
154154
}
155155

ocpp-v1_6/src/main/java/eu/chargetime/ocpp/model/firmware/GetDiagnosticsRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ public boolean equals(Object o) {
178178
if (this == o) return true;
179179
if (o == null || getClass() != o.getClass()) return false;
180180
GetDiagnosticsRequest that = (GetDiagnosticsRequest) o;
181-
return retries == that.retries
182-
&& retryInterval == that.retryInterval
181+
return Objects.equals(retries, that.retries)
182+
&& Objects.equals(retryInterval, that.retryInterval)
183183
&& Objects.equals(location, that.location)
184184
&& Objects.equals(startTime, that.startTime)
185185
&& Objects.equals(stopTime, that.stopTime);

0 commit comments

Comments
 (0)