private void renderLicenseContent()

in src/main/java/org/apache/maven/report/projectinfo/LicensesReport.java [316:343]


        private void renderLicenseContent(URL licenseUrl) {
            try {
                // All licenses are supposed to be in English...
                String licenseContent = ProjectInfoReportUtils.getContent(licenseUrl, settings, licenseFileEncoding);

                // TODO: we should check for a text/html mime type instead, and possibly use a html parser to do this a
                // bit more cleanly/reliably.
                String licenseContentLC = licenseContent.toLowerCase(Locale.ENGLISH);
                int bodyStart = licenseContentLC.indexOf("<body");
                int bodyEnd = licenseContentLC.indexOf("</body>");

                if ((licenseContentLC.contains("<!doctype html") || licenseContentLC.contains("<html>"))
                        && ((bodyStart >= 0) && (bodyEnd > bodyStart))) {
                    bodyStart = licenseContentLC.indexOf('>', bodyStart) + 1;
                    String body = licenseContent.substring(bodyStart, bodyEnd);

                    link(licenseUrl.toExternalForm(), getI18nString("originalText"));
                    paragraph(getI18nString("copy"));

                    body = replaceRelativeLinks(body, baseURL(licenseUrl).toExternalForm());
                    sink.rawText(body);
                } else {
                    verbatimText(licenseContent);
                }
            } catch (IOException e) {
                paragraph("Can't read the url [" + licenseUrl + "] : " + e.getMessage());
            }
        }