Fix logging and prevent similar issues by dodgex · Pull Request #2148 · androidannotations/androidannotations · GitHub
Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public OutputStream openBinary(JPackage pkg, String fileName) throws IOException

return sourceFile.openOutputStream();
} catch (FilerException e) {
LOGGER.error("Could not generate source file for {}", qualifiedClassName, e.getMessage());
LOGGER.error("Could not generate source file for {} due to error: {}", qualifiedClassName, e.getMessage());
/*
* This exception is expected, when some files are created twice. We
* cannot delete existing files, unless using a dirty hack. Files a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private boolean generateElements(AnnotationElements validatedModel, ProcessHolde
if (validatedElements.contains(enclosingElement)) {
isElementRemaining = true;
} else {
LOGGER.error("Enclosing element {} has not been successfully validated", annotatedElement, enclosingElement);
LOGGER.error(annotatedElement, "Enclosing element {} has not been successfully validated", enclosingElement);
}
} else {
GeneratedClassHolder generatedClassHolder = generatingAnnotationHandler.createGeneratedClassHolder(environment, typeElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ public AnnotationElements validate(AnnotationElements extractedModel, Annotation

AnnotationMirror annotationMirror = elementValidation.getAnnotationMirror();
for (ElementValidation.Error error : elementValidation.getErrors()) {
LOGGER.error(error.getMessage(), error.getElement(), annotationMirror);
LOGGER.error(error.getElement(), annotationMirror, error.getMessage());
}

for (String warning : elementValidation.getWarnings()) {
LOGGER.warn(warning, elementValidation.getElement(), annotationMirror);
LOGGER.warn(elementValidation.getElement(), annotationMirror, warning);
}

if (elementValidation.isValid()) {
validatedAnnotatedElements.add(annotatedElement);
} else {
LOGGER.warn("Element {} invalidated by {}", annotatedElement, annotatedElement, validatorSimpleName);
LOGGER.warn(annotatedElement, "Element {} invalidated by {}", annotatedElement, validatorSimpleName);
}
}
}
Expand Down