Skip to content

Commit 35275fc

Browse files
committed
Add errorCode byte to response payload
1 parent 74e2a64 commit 35275fc

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

base/src/main/java/com/smartdevicelink/protocol/SecurityQueryPayload.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,24 @@ public static SecurityQueryPayload parseBinaryQueryHeader(byte[] binHeader) {
8585
}
8686

8787
public byte[] assembleSecurityQueryPayload(int payloadSize) {
88-
byte[] payLoad = new byte[SECURITY_QUERY_HEADER_SIZE + payloadSize];
89-
System.arraycopy(assembleHeaderBytes(), 0, payLoad, 0, SECURITY_QUERY_HEADER_SIZE);
90-
88+
byte[] payLoad = new byte[SECURITY_QUERY_HEADER_SIZE];
9189
if (_securityQueryID == SecurityQueryID.SEND_INTERNAL_ERROR && _securityQueryType == SecurityQueryType.NOTIFICATION) {
90+
payLoad = new byte[SECURITY_QUERY_HEADER_SIZE + payloadSize + 1];
9291
System.arraycopy(_jsonData, 0, payLoad, SECURITY_QUERY_HEADER_SIZE, _jsonSize);
92+
byte[] errorCode = new byte[1];
93+
if (this._errorCode != null) {
94+
errorCode[0] = _errorCode.getValue();
95+
} else {
96+
errorCode[0] = SecurityQueryErrorCode.ERROR_UNKNOWN_INTERNAL_ERROR.getValue();
97+
}
98+
System.arraycopy(errorCode, 0, payLoad, payLoad.length - 1, 1);
9399
} else if (_securityQueryID == SecurityQueryID.SEND_HANDSHAKE_DATA && _securityQueryType == SecurityQueryType.RESPONSE) {
100+
payLoad = new byte[SECURITY_QUERY_HEADER_SIZE + payloadSize];
94101
System.arraycopy(_bulkData, 0, payLoad, SECURITY_QUERY_HEADER_SIZE, payloadSize);
95102
}
96103

104+
System.arraycopy(assembleHeaderBytes(), 0, payLoad, 0, SECURITY_QUERY_HEADER_SIZE);
105+
97106
return payLoad;
98107
}
99108

base/src/main/java/com/smartdevicelink/session/BaseSdlSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ protected void processControlService(ProtocolMessage msg) {
239239
return;
240240
}
241241

242-
iNumBytes = sdlSecurity.runHandshake(data, dataToRead);
242+
iNumBytes = null;
243243

244244
// Assemble a security query payload header for our response
245245
SecurityQueryPayload responseHeader = new SecurityQueryPayload();

0 commit comments

Comments
 (0)