if (definition.sizeOfMessageArray() == 0) {
messages = Collections.emptyList();
} else {
messages = new ArrayList<Message>(definition.sizeOfMessageArray());
for (org.mitre.oval.xmlSchema.ovalCommon5.MessageType messageType : definition.getMessageList()) {
Message message;
switch (messageType.getLevel().intValue()) {
case MessageLevelEnumeration.INT_DEBUG:
message = new Message(Message.Severity.INFO, "DEBUG: "
+ messageType.getStringValue(), "OVALDI");
break;
case MessageLevelEnumeration.INT_ERROR:
message = new Message(Message.Severity.ERROR, messageType
.getStringValue(), "OVALDI");
break;
case MessageLevelEnumeration.INT_FATAL:
message = new Message(Message.Severity.ERROR, "Fatal: "
+ messageType.getStringValue(), "OVALDI");
break;
case MessageLevelEnumeration.INT_INFO:
message = new Message(Message.Severity.INFO, messageType
.getStringValue(), "OVALDI");
break;
case MessageLevelEnumeration.INT_WARNING:
message = new Message(Message.Severity.WARNING, messageType
.getStringValue(), "OVALDI");
break;
default:
throw new RuntimeException("Unhandled message type: "
+ messageType.getLevel().toString() + ": "