Skip to content

Move quick return to top of method isStandardLicenseExceptionWithinText #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,10 @@ public static boolean isStandardLicenseWithinText(String text, ListedLicense lic
* @return True if the license exception is found within the text, false otherwise (or if either argument is null)
*/
public static boolean isStandardLicenseExceptionWithinText(String text, ListedLicenseException exception) {
boolean result = false;
if (text == null || text.isEmpty() || exception == null) {
return false;
}
boolean result = false;
try {
return new TemplateRegexMatcher(exception.getStandardAdditionTemplate().orElse(exception.getAdditionText())).isTemplateMatchWithinText(text);
} catch (SpdxCompareException e) {
Expand Down Expand Up @@ -796,7 +796,6 @@ public static DifferenceDescription isTextStandardException(org.spdx.library.mod
* @return True if the license is found within the text, false otherwise (or if either argument is null)
*/
public static boolean isStandardLicenseWithinText(String text, org.spdx.library.model.v2.license.SpdxListedLicense license) {

try {
return new TemplateRegexMatcher(license.getStandardLicenseTemplate()).isTemplateMatchWithinText(text);
} catch (SpdxCompareException e) {
Expand All @@ -816,10 +815,10 @@ public static boolean isStandardLicenseWithinText(String text, org.spdx.library.
* @return True if the license exception is found within the text, false otherwise (or if either argument is null)
*/
public static boolean isStandardLicenseExceptionWithinText(String text, org.spdx.library.model.v2.license.ListedLicenseException exception) {
boolean result = false;
if (text == null || text.isEmpty() || exception == null) {
return false;
}
boolean result = false;
try {
return new TemplateRegexMatcher(exception.getLicenseExceptionTemplate()).isTemplateMatchWithinText(text);
} catch (SpdxCompareException e) {
Expand Down Expand Up @@ -902,4 +901,4 @@ public static boolean isLicensePassWhiteList(
}
}

}
}