Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ private void writeClientAdapter(ControllerReader reader) {

try {
if (reader.beanType().getInterfaces().isEmpty()
&& "java.lang.Object".equals(reader.beanType().getSuperclass().toString())) {
new TestClientWriter(reader).write();
&& "java.lang.Object".equals(reader.beanType().getSuperclass().toString())
&& new TestClientWriter(reader).write()) {
clientFQNs.add(reader.beanType().getQualifiedName().toString() + "TestAPI");
}
} catch (final IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ protected String initPackageName(String originName) {
return dp > -1 ? originName.substring(0, dp) : null;
}

void write() {
if (methods.isEmpty()) return;
boolean write() {
if (methods.isEmpty()) return false;
writePackage();
writeImports();
writeClassStart();
writeAddRoutes();
return true;
}

protected void writePackage() {
Expand Down
29 changes: 29 additions & 0 deletions tests/test-jex/src/main/java/org/example/web/ErrorController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.example.web;

import io.avaje.http.api.Controller;
import io.avaje.http.api.ExceptionHandler;
import io.avaje.http.api.Filter;
import io.avaje.http.api.Produces;
import io.avaje.jex.http.Context;
import io.avaje.jex.http.HttpFilter.FilterChain;

@Controller
public class ErrorController {

@Filter
void filter(FilterChain chain) {
// do nothing
chain.proceed();
}

@ExceptionHandler
String exception(RuntimeException ex) {
return "Err: " + ex;
}

@Produces(statusCode = 501)
@ExceptionHandler
HelloDto exceptionCtx(IllegalAccessException ex, Context ctx) {
return null;
}
}