public static void validateString(String value, StringParameter param)
throws PDUStringException {
if (param.getType() == StringType.C_OCTEC_STRING) {
if (param.isRangeMinAndMax()) {
if (!isCOctetStringValid(value, param.getMax())) {
throw new PDUStringException("C-Octet String value '"
+ value + "' cannot more than " + param.getMax()
+ ". Actual length of string is " + value.length(),
param);
}
} else if (!isCOctetStringNullOrNValValid(value, param.getMax())) {
throw new PDUStringException(
"C-Octet String value should be 1 or " + param.getMax()
+ ". The actual length of string is "
+ value.length(), param);
}
} else if (param.getType() == StringType.OCTET_STRING
&& !isOctetStringValid(value, param.getMax())) {
throw new PDUStringException("Octet String value '" + value
+ "' cannot more than " + param.getMax()
+ ". Actual length of string is " + value.length(), param);
}
}