foundMatchingType = true;
break;
}
}
if (!foundMatchingType)
throw new DataFormatException("byte[] is not a valid update msg: "
+ encodedMsg[0]);
/*
* For older protocol version PDUs, decode the matching version header
* instead.
*/
if ((encodedMsg[0] == MSG_TYPE_ADD_V1) ||
(encodedMsg[0] == MSG_TYPE_DELETE_V1) ||
(encodedMsg[0] == MSG_TYPE_MODIFYDN_V1) ||
(encodedMsg[0] == MSG_TYPE_MODIFY_V1))
{
return decodeHeader_V1(encodedMsg);
}
/* read the protocol version */
protocolVersion = (short)encodedMsg[1];
try
{
/* Read the changeNumber */
int pos = 2;
int length = getNextLength(encodedMsg, pos);
String changenumberStr = new String(encodedMsg, pos, length, "UTF-8");
pos += length + 1;
changeNumber = new ChangeNumber(changenumberStr);
/* Read the dn */
length = getNextLength(encodedMsg, pos);
dn = new String(encodedMsg, pos, length, "UTF-8");
pos += length + 1;
/* Read the entryuuid */
length = getNextLength(encodedMsg, pos);
uniqueId = new String(encodedMsg, pos, length, "UTF-8");
pos += length + 1;
/* Read the assured information */
if (encodedMsg[pos++] == 1)
assuredFlag = true;
else
assuredFlag = false;
/* Read the assured mode */
assuredMode = AssuredMode.valueOf(encodedMsg[pos++]);
/* Read the safe data level */
safeDataLevel = encodedMsg[pos++];
return pos;
} catch (UnsupportedEncodingException e)
{
throw new DataFormatException("UTF-8 is not supported by this jvm.");
} catch (IllegalArgumentException e)
{
throw new DataFormatException(e.getMessage());
}
}