protected void renderBody()

in src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java [231:309]


        protected void renderBody() {
            List<License> licenses = project.getModel().getLicenses();

            if (licenses.isEmpty()) {
                startSection(getTitle());

                paragraph(getI18nString("nolicense"));

                endSection();

                return;
            }

            // Overview
            startSection(getI18nString("overview.title"));

            paragraph(getI18nString("overview.intro"));

            endSection();

            // License
            startSection(getI18nString("title"));

            if (licenses.size() > 1) {
                // multiple licenses
                paragraph(getI18nString("multiple"));

                if (!linkOnly) {
                    // add an index before licenses content
                    sink.list();
                    for (License license : licenses) {
                        String name = license.getName();
                        if (name == null || name.isEmpty()) {
                            name = getI18nString("unnamed");
                        }

                        sink.listItem();
                        link("#" + DoxiaUtils.encodeId(name), name);
                        sink.listItem_();
                    }
                    sink.list_();
                }
            }

            for (License license : licenses) {
                String name = license.getName();
                if (name == null || name.isEmpty()) {
                    name = getI18nString("unnamed");
                }

                String url = license.getUrl();
                String comments = license.getComments();

                startSection(name);

                if (!(comments == null || comments.isEmpty())) {
                    paragraph(comments);
                }

                if (url != null) {
                    try {
                        URL licenseUrl = getLicenseURL(project, url);

                        if (linkOnly) {
                            link(licenseUrl.toExternalForm(), licenseUrl.toExternalForm());
                        } else {
                            renderLicenseContent(licenseUrl);
                        }
                    } catch (IOException e) {
                        // I18N message
                        paragraph(e.getMessage());
                    }
                }

                endSection();
            }

            endSection();
        }