mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-20 00:17:04 +00:00
[querybean-generator] FilerException trying to write EntityClassRegister with Quarkus dev mode / hot reload #3541
Drop to log at WARN level when we catch FilerException such that Quarkus dev mode / hot reload works
This commit is contained in:
+4
-4
@@ -415,9 +415,10 @@ class ProcessingContext implements Constants {
|
|||||||
messager.printMessage(Diagnostic.Kind.ERROR, String.format(msg, args), e);
|
messager.printMessage(Diagnostic.Kind.ERROR, String.format(msg, args), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void logWarn(String msg, Object... args) {
|
||||||
* Log a info message.
|
messager.printMessage(Diagnostic.Kind.WARNING, String.format(msg, args));
|
||||||
*/
|
}
|
||||||
|
|
||||||
void logNote(String msg, Object... args) {
|
void logNote(String msg, Object... args) {
|
||||||
messager.printMessage(Diagnostic.Kind.NOTE, String.format(msg, args));
|
messager.printMessage(Diagnostic.Kind.NOTE, String.format(msg, args));
|
||||||
}
|
}
|
||||||
@@ -559,7 +560,6 @@ class ProcessingContext implements Constants {
|
|||||||
} catch (FilerException e) {
|
} catch (FilerException e) {
|
||||||
logNote(null, "FilerException reading services file: " + e.getMessage());
|
logNote(null, "FilerException reading services file: " + e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
logError(null, "Error reading services file: " + e.getMessage());
|
logError(null, "Error reading services file: " + e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
+3
-20
@@ -19,14 +19,12 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
private static final String KAPT_KOTLIN_GENERATED_OPTION = "kapt.kotlin.generated";
|
private static final String KAPT_KOTLIN_GENERATED_OPTION = "kapt.kotlin.generated";
|
||||||
|
|
||||||
private ProcessingContext processingContext;
|
private ProcessingContext processingContext;
|
||||||
private SimpleModuleInfoWriter moduleWriter;
|
|
||||||
|
|
||||||
public Processor() {
|
public Processor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getSupportedOptions() {
|
public Set<String> getSupportedOptions() {
|
||||||
|
|
||||||
Set<String> options = new LinkedHashSet<>();
|
Set<String> options = new LinkedHashSet<>();
|
||||||
options.add(KAPT_KOTLIN_GENERATED_OPTION);
|
options.add(KAPT_KOTLIN_GENERATED_OPTION);
|
||||||
options.add(GENERATE_KOTLIN_CODE_OPTION);
|
options.add(GENERATE_KOTLIN_CODE_OPTION);
|
||||||
@@ -61,7 +59,6 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
int count = processEntities(roundEnv);
|
int count = processEntities(roundEnv);
|
||||||
processOthers(roundEnv);
|
processOthers(roundEnv);
|
||||||
final int loaded = processingContext.complete();
|
final int loaded = processingContext.complete();
|
||||||
initModuleInfoBean();
|
|
||||||
if (roundEnv.processingOver()) {
|
if (roundEnv.processingOver()) {
|
||||||
writeModuleInfoBean();
|
writeModuleInfoBean();
|
||||||
}
|
}
|
||||||
@@ -98,26 +95,12 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initModuleInfoBean() {
|
|
||||||
try {
|
|
||||||
if (moduleWriter == null) {
|
|
||||||
moduleWriter = new SimpleModuleInfoWriter(processingContext);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to initialise EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeModuleInfoBean() {
|
private void writeModuleInfoBean() {
|
||||||
try {
|
try {
|
||||||
if (moduleWriter == null) {
|
new SimpleModuleInfoWriter(processingContext).write();
|
||||||
processingContext.logError(null, "EntityClassRegister was not initialised and not written");
|
} catch (FilerException e) {
|
||||||
} else {
|
processingContext.logWarn(null, "FilerException trying to write EntityClassRegister error: " + e);
|
||||||
moduleWriter.write();
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to write EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
processingContext.logError(null, "Failed to write EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -50,7 +50,6 @@ class SimpleModuleInfoWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to write services file " + e.getMessage());
|
processingContext.logError(null, "Failed to write services file " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +69,6 @@ class SimpleModuleInfoWriter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to write services file " + e.getMessage());
|
processingContext.logError(null, "Failed to write services file " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
<version>14.8.1</version>
|
<version>14.8.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<version>14.8.2-RC2</version>
|
||||||
<name>querybean generator</name>
|
<name>querybean generator</name>
|
||||||
<description>Querybean generator</description>
|
|
||||||
<artifactId>querybean-generator</artifactId>
|
<artifactId>querybean-generator</artifactId>
|
||||||
|
<description>Querybean generator</description>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
+4
-1
@@ -403,6 +403,10 @@ class ProcessingContext implements Constants {
|
|||||||
messager.printMessage(Diagnostic.Kind.ERROR, String.format(msg, args), e);
|
messager.printMessage(Diagnostic.Kind.ERROR, String.format(msg, args), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void logWarn(String msg, Object... args) {
|
||||||
|
messager.printMessage(Diagnostic.Kind.WARNING, String.format(msg, args));
|
||||||
|
}
|
||||||
|
|
||||||
void logNote(String msg, Object... args) {
|
void logNote(String msg, Object... args) {
|
||||||
messager.printMessage(Diagnostic.Kind.NOTE, String.format(msg, args));
|
messager.printMessage(Diagnostic.Kind.NOTE, String.format(msg, args));
|
||||||
}
|
}
|
||||||
@@ -549,7 +553,6 @@ class ProcessingContext implements Constants {
|
|||||||
} catch (FilerException e) {
|
} catch (FilerException e) {
|
||||||
logNote(null, "FilerException reading services file: " + e.getMessage());
|
logNote(null, "FilerException reading services file: " + e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
logError(null, "Error reading services file: " + e.getMessage());
|
logError(null, "Error reading services file: " + e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package io.ebean.querybean.generator;
|
package io.ebean.querybean.generator;
|
||||||
|
|
||||||
import javax.annotation.processing.AbstractProcessor;
|
import javax.annotation.processing.AbstractProcessor;
|
||||||
|
import javax.annotation.processing.FilerException;
|
||||||
import javax.annotation.processing.ProcessingEnvironment;
|
import javax.annotation.processing.ProcessingEnvironment;
|
||||||
import javax.annotation.processing.RoundEnvironment;
|
import javax.annotation.processing.RoundEnvironment;
|
||||||
import javax.lang.model.SourceVersion;
|
import javax.lang.model.SourceVersion;
|
||||||
@@ -16,7 +17,6 @@ import java.util.Set;
|
|||||||
public class Processor extends AbstractProcessor implements Constants {
|
public class Processor extends AbstractProcessor implements Constants {
|
||||||
|
|
||||||
private ProcessingContext processingContext;
|
private ProcessingContext processingContext;
|
||||||
private SimpleModuleInfoWriter moduleWriter;
|
|
||||||
|
|
||||||
public Processor() {
|
public Processor() {
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,6 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
int count = processEntities(roundEnv);
|
int count = processEntities(roundEnv);
|
||||||
processOthers(roundEnv);
|
processOthers(roundEnv);
|
||||||
final int loaded = processingContext.complete();
|
final int loaded = processingContext.complete();
|
||||||
initModuleInfoBean();
|
|
||||||
if (roundEnv.processingOver()) {
|
if (roundEnv.processingOver()) {
|
||||||
writeModuleInfoBean();
|
writeModuleInfoBean();
|
||||||
}
|
}
|
||||||
@@ -86,26 +85,12 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initModuleInfoBean() {
|
|
||||||
try {
|
|
||||||
if (moduleWriter == null) {
|
|
||||||
moduleWriter = new SimpleModuleInfoWriter(processingContext);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to initialise EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeModuleInfoBean() {
|
private void writeModuleInfoBean() {
|
||||||
try {
|
try {
|
||||||
if (moduleWriter == null) {
|
new SimpleModuleInfoWriter(processingContext).write();
|
||||||
processingContext.logError(null, "EntityClassRegister was not initialised and not written");
|
} catch (FilerException e) {
|
||||||
} else {
|
processingContext.logWarn(null, "FilerException trying to write EntityClassRegister error: " + e);
|
||||||
moduleWriter.write();
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(null, "Failed to write EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
processingContext.logError(null, "Failed to write EntityClassRegister error:" + e + " stack:" + Arrays.toString(e.getStackTrace()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +100,6 @@ public class Processor extends AbstractProcessor implements Constants {
|
|||||||
SimpleQueryBeanWriter beanWriter = new SimpleQueryBeanWriter((TypeElement) element, processingContext);
|
SimpleQueryBeanWriter beanWriter = new SimpleQueryBeanWriter((TypeElement) element, processingContext);
|
||||||
beanWriter.writeRootBean();
|
beanWriter.writeRootBean();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
|
||||||
processingContext.logError(element, "Error generating query beans: " + e);
|
processingContext.logError(element, "Error generating query beans: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user