LUCENE-10419: revert debugging changes.

This commit is contained in:
Dawid Weiss 2022-02-13 18:34:57 +01:00
parent 50b7e2970f
commit a861ff8df2
1 changed files with 7 additions and 22 deletions

View File

@ -173,22 +173,8 @@ class ValidateSourcePatternsTask extends DefaultTask {
def validSPINameJavadocTag = ~$/(?s)\s*\*\s*@lucene\.spi\s+\{@value #NAME\}/$;
def isLicense = { matcher, ratDocument ->
boolean retValue = false
Exception rethrow = null
int retries = 5
do {
try {
licenseMatcher.reset()
retValue = lineSplitter.split(matcher.group(1)).any { licenseMatcher.match(ratDocument, it) }
if (retValue) break
} catch (StringIndexOutOfBoundsException | RuntimeException e) {
logger.error("Exception thrown=" + e + ", retries: " + retries + ", matcher.group(1)=" + matcher.group(1))
rethrow = e
}
} while (retries-- > 0)
if (rethrow != null) throw rethrow
return retValue
licenseMatcher.reset()
return lineSplitter.split(matcher.group(1)).any { licenseMatcher.match(ratDocument, it) }
}
def checkLicenseHeaderPrecedes = { f, description, contentPattern, commentPattern, text, ratDocument ->
@ -218,12 +204,11 @@ class ValidateSourcePatternsTask extends DefaultTask {
progress.start(this.name, this.name)
sourceFiles.each { f ->
progress.progress("Scanning ${f.name}")
logger.debug('Scanning source file: {}', f);
def text = f.getText('UTF-8');
try {
progress.progress("Scanning ${f.name}")
logger.debug('Scanning source file: {}', f);
def text = f.getText('UTF-8');
invalidPatterns.each { pattern, name ->
if (pattern.matcher(text).find()) {
reportViolation(f, name);
@ -272,7 +257,7 @@ class ValidateSourcePatternsTask extends DefaultTask {
}
} catch (e) {
e.printStackTrace()
throw new GradleException("Unhandled exception while validating patterns on file: " + f + ", content: >>" + text + "<<", e)
throw new GradleException("Unhandled exception while validating patterns on file: " + f, e)
}
}