protected void addMessage()

in src/main/java/org/apache/maven/plugin/doap/DoapMojo.java [2236:2301]


        protected void addMessage(String[] tags, String value, int errorId) {
            if (tags == null) {
                throw new IllegalArgumentException("tags is required");
            }

            boolean isPom = false;
            if (tags[0].equalsIgnoreCase("project")) {
                isPom = true;
            }
            switch (errorId) {
                case REQUIRED:
                    errorMessages.add("A " + toConfiguration(tags, null) + "  parameter is required.");
                    break;
                case REQUIRED_BY_ASF_OR_RECOMMENDED:
                    if (isPom) {
                        if (asfExtOptions.isIncluded()) {
                            errorMessages.add("A POM " + toConfiguration(tags, null) + " value is required by ASF.");
                        } else {
                            warnMessages.add("No POM " + toConfiguration(tags, null)
                                    + " value is defined, it is highly recommended to have one.");
                        }
                    } else {
                        if (asfExtOptions.isIncluded()) {
                            errorMessages.add("A " + toConfiguration(tags, null) + " parameter is required by ASF.");
                        } else {
                            warnMessages.add("No " + toConfiguration(tags, null)
                                    + " parameter defined, it is highly recommended to have one.");
                        }
                    }
                    break;
                case REQUIRED_BY_ASF:
                    if (isPom) {
                        errorMessages.add("A POM " + toConfiguration(tags, null) + " value is required by ASF.");
                    } else {
                        errorMessages.add("A " + toConfiguration(tags, null) + " parameter is required by ASF.");
                    }
                    break;
                case RECOMMENDED:
                    warnMessages.add("No " + toConfiguration(tags, null)
                            + " parameter defined, it is highly recommended to have one.");
                    break;
                case INVALID_URL:
                    if (isPom) {
                        errorMessages.add("The POM " + toConfiguration(tags, value) + " value is not a valid URL.");
                    } else {
                        errorMessages.add("The " + toConfiguration(tags, value) + " parameter is not a valid URL.");
                    }
                    break;
                case INVALID_DATE:
                    errorMessages.add("The " + toConfiguration(tags, value) + " parameter should be in YYYY-MM-DD.");
                    break;
                case INVALID_EMAIL:
                    errorMessages.add("The POM " + toConfiguration(tags, value) + " value is not a valid email.");
                    break;
                case INVALID_ISO_DATE:
                    errorMessages.add(
                            "The " + toConfiguration(tags, value) + " parameter is not a valid ISO language.");
                    break;
                case SHORT_DESC_TOO_LONG:
                    errorMessages.add("The " + toConfiguration(tags, value)
                            + " first sentence is too long maximum words number is 10.");
                    break;
                default:
                    throw new IllegalArgumentException("Unknown errorId=" + errorId);
            }
        }