Skip to content

Commit dc1235a

Browse files
bactgoneall
authored andcommitted
Move quick return to top of method isStandardLicenseExceptionWithinText
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
1 parent 662b4f8 commit dc1235a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/org/spdx/utility/compare/LicenseCompareHelper.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ public static boolean isStandardLicenseWithinText(String text, ListedLicense lic
454454
* @return True if the license exception is found within the text, false otherwise (or if either argument is null)
455455
*/
456456
public static boolean isStandardLicenseExceptionWithinText(String text, ListedLicenseException exception) {
457-
boolean result = false;
458457
if (text == null || text.isEmpty() || exception == null) {
459458
return false;
460459
}
460+
boolean result = false;
461461
try {
462462
return new TemplateRegexMatcher(exception.getStandardAdditionTemplate().orElse(exception.getAdditionText())).isTemplateMatchWithinText(text);
463463
} catch (SpdxCompareException e) {
@@ -796,7 +796,6 @@ public static DifferenceDescription isTextStandardException(org.spdx.library.mod
796796
* @return True if the license is found within the text, false otherwise (or if either argument is null)
797797
*/
798798
public static boolean isStandardLicenseWithinText(String text, org.spdx.library.model.v2.license.SpdxListedLicense license) {
799-
800799
try {
801800
return new TemplateRegexMatcher(license.getStandardLicenseTemplate()).isTemplateMatchWithinText(text);
802801
} catch (SpdxCompareException e) {
@@ -816,10 +815,10 @@ public static boolean isStandardLicenseWithinText(String text, org.spdx.library.
816815
* @return True if the license exception is found within the text, false otherwise (or if either argument is null)
817816
*/
818817
public static boolean isStandardLicenseExceptionWithinText(String text, org.spdx.library.model.v2.license.ListedLicenseException exception) {
819-
boolean result = false;
820818
if (text == null || text.isEmpty() || exception == null) {
821819
return false;
822820
}
821+
boolean result = false;
823822
try {
824823
return new TemplateRegexMatcher(exception.getLicenseExceptionTemplate()).isTemplateMatchWithinText(text);
825824
} catch (SpdxCompareException e) {
@@ -902,4 +901,4 @@ public static boolean isLicensePassWhiteList(
902901
}
903902
}
904903

905-
}
904+
}

0 commit comments

Comments
 (0)