Skip to content

Commit 2264f62

Browse files
authored
Merge pull request #1527 from OSGP/feature/Add-rejected-permanent/transient-exception-types
Add rejected permanent/transient exception types
2 parents 7aba53e + ce7bb1c commit 2264f62

File tree

3 files changed

+11
-8
lines changed
  • osgp
    • protocol-adapter-dlms/osgp-protocol-adapter-dlms/src
    • shared/shared/src/main/java/org/opensmartgridplatform/shared/exceptionhandling

3 files changed

+11
-8
lines changed

osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/factories/DlmsConnector.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.CONNECTION_RESET;
1313
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.CONNECTION_TIMED_OUT;
1414
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.ILLEGAL_RESPONSE;
15+
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.REJECTED_PERMANENT;
16+
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.REJECTED_TRANSIENT;
1517
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.RESPONSE_TIMEOUT;
1618
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.SOCKET_CLOSED_BY_REMOTE;
1719
import static org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType.UNABLE_TO_DECYPHER;
@@ -53,6 +55,8 @@ public abstract class DlmsConnector {
5355
errorMap.put("ILLEGAL_RESPONSE", ILLEGAL_RESPONSE);
5456
errorMap.put("RESPONSE_TIMEOUT", RESPONSE_TIMEOUT);
5557
errorMap.put("UNKNOWN_ASSOCIATION_RESULT", UNKNOWN_ASSOCIATION_RESULT);
58+
errorMap.put("REJECTED_PERMANENT", REJECTED_PERMANENT);
59+
errorMap.put("REJECTED_TRANSIENT", REJECTED_TRANSIENT);
5660
}
5761

5862
public abstract DlmsConnection connect(

osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/test/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/factories/DlmsConnectorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class DlmsConnectorTest {
2626
"Unable to decypher/decrypt xDLMS pdu,UNABLE_TO_DECYPHER",
2727
"WRAPPER_HEADER_INVALID_VERSION,WRAPPER_HEADER_INVALID",
2828
"UNKNOWN_ASSOCIATION_RESULT,UNKNOWN_ASSOCIATION_RESULT",
29+
"REJECTED_PERMANENT,REJECTED_PERMANENT",
30+
"REJECTED_TRANSIENT,REJECTED_TRANSIENT"
2931
})
3032
void testGetExceptionWithExceptionType(
3133
final String message, final FunctionalExceptionType expectedType) {

osgp/shared/shared/src/main/java/org/opensmartgridplatform/shared/exceptionhandling/FunctionalExceptionType.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
package org.opensmartgridplatform.shared.exceptionhandling;
66

7+
import lombok.Getter;
8+
9+
@Getter
710
public enum FunctionalExceptionType {
811
// Organisation exceptions
912
UNKNOWN_ORGANISATION(101, "UNKNOWN_ORGANISATION"),
@@ -47,6 +50,8 @@ public enum FunctionalExceptionType {
4750
ILLEGAL_RESPONSE(232, "ILLEGAL_RESPONSE"),
4851
RESPONSE_TIMEOUT(233, "RESPONSE_TIMEOUT"),
4952
UNKNOWN_ASSOCIATION_RESULT(234, "UNKNOWN_ASSOCIATION_RESULT"),
53+
REJECTED_PERMANENT(235, "REJECTED_PERMANENT"),
54+
REJECTED_TRANSIENT(236, "REJECTED_TRANSIENT"),
5055

5156
// Authorization exceptions
5257
UNAUTHORIZED(301, "UNAUTHORIZED"),
@@ -110,12 +115,4 @@ public enum FunctionalExceptionType {
110115
this.code = code;
111116
this.message = message;
112117
}
113-
114-
public int getCode() {
115-
return this.code;
116-
}
117-
118-
public String getMessage() {
119-
return this.message;
120-
}
121118
}

0 commit comments

Comments
 (0)