private static void addMessageWithIdCheck(
        final ObjectHashSet<String> distinctNames,
        final Map<Long, Message> messageByIdMap,
        final Message message,
        final Node node)
    {
        if (messageByIdMap.get((long)message.id()) != null)
        {
            handleError(node, "message template id already exists: " + message.id());
        }

        if (!distinctNames.add(message.name()))
        {
            handleError(node, "message name already exists: " + message.name());
        }

        checkForValidName(node, message.name());

        messageByIdMap.put((long)message.id(), message);
    }
Check name against validity for C++ and Java naming. Warning if not valid.

@param node to have the name checked.
@param name of the node to be checked.
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java