{
return fieldValue.getBytes(Charset.defaultCharset());
}
if (fieldValue.length() <= 2)
{
throw new DatabusException("Unable to decode the string because length is less than 2");
}
if (!isStringHex(fieldValue))
{
throw new DatabusException("Unable to decode the string because it is not hex-encoded");
}
try
{
return stringToHex(fieldValue.substring(2, fieldValue.length()-1));
}
catch (DecoderException e)
{
throw new DatabusException("Unable to decode a " + databaseFieldType + " field: " + recordFieldName);
}
}
//return array
else if (databaseFieldType.equalsIgnoreCase("ARRAY"))
{
throw new DatabusException("ARRAY type still not implemented!"); //TODO add support for array
}
//return record
else if (databaseFieldType.equalsIgnoreCase("TABLE"))
{
throw new DatabusException("TABLE type still not implemented!"); //TODO add support for table
}
else
{
throw new DatabusException("unknown field type: " + recordFieldName + ":" + databaseFieldType);
}
}