diff --git a/src/org/spdx/htmltemplates/ExceptionHtmlToc.java b/src/org/spdx/htmltemplates/ExceptionHtmlToc.java index 50937a7..ea42001 100644 --- a/src/org/spdx/htmltemplates/ExceptionHtmlToc.java +++ b/src/org/spdx/htmltemplates/ExceptionHtmlToc.java @@ -20,6 +20,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.util.Comparator; import java.util.List; import java.util.Map; @@ -244,6 +245,14 @@ public void writeToFile(File exceptionTocFile, String version) throws MustacheEx Map mustacheMap = Maps.newHashMap(); mustacheMap.put("version", StringEscapeUtils.escapeHtml4(version)); + exceptions.sort(new Comparator() { + + @Override + public int compare(ExceptionRow arg0, ExceptionRow arg1) { + return arg0.getLicenseExceptionId().compareTo(arg1.getLicenseExceptionId()); + } + + }); mustacheMap.put("listedExceptions", exceptions); mustacheMap.put("deprecatedExceptions", deprecatedExceptions); FileOutputStream stream = null; diff --git a/src/org/spdx/htmltemplates/LicenseTOCHTMLFile.java b/src/org/spdx/htmltemplates/LicenseTOCHTMLFile.java index ebb8a33..ed7e8cf 100644 --- a/src/org/spdx/htmltemplates/LicenseTOCHTMLFile.java +++ b/src/org/spdx/htmltemplates/LicenseTOCHTMLFile.java @@ -20,6 +20,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; +import java.util.Comparator; import java.util.List; import java.util.Map; @@ -304,6 +305,14 @@ public void writeToFile(File htmlFile) throws IOException, MustacheException { private Map buildMustachMap() { Map retval = Maps.newHashMap(); retval.put("version", generateVersionString(version, releaseDate)); + this.listedLicenses.sort(new Comparator() { + + @Override + public int compare(ListedSpdxLicense arg0, ListedSpdxLicense arg1) { + return arg0.getLicenseId().compareToIgnoreCase(arg1.getLicenseId()); + } + + }); retval.put("listedLicenses", this.listedLicenses); retval.put("deprecatedLicenses", this.deprecatedLicenses); return retval; @@ -320,6 +329,4 @@ public void addDeprecatedLicense(SpdxListedLicense deprecatedLicense, deprecatedLicense.getDeprecatedVersion())); currentRefNumber++; } - - }