LUCENE-10419: more debugging code. The message from AbstractStringBuilder suggests a concurrency issue somewhere, but I just can't see it!

This commit is contained in:
Dawid Weiss 2022-02-12 20:22:49 +01:00
parent 21c5b42063
commit 50b7e2970f
1 changed files with 22 additions and 7 deletions

View File

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