in aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/EventHandlerLoader.java [640:671]
public void handleRequest(InputStream inputStream, OutputStream outputStream, Context context)
throws IOException {
final Object input;
final Platform platform = getPlatform(context);
try {
if (inputType.isPresent()) {
input = getSerializerCached(platform, inputType.get()).fromJson(inputStream);
} else {
input = null;
}
} catch (Throwable t) {
throw new RuntimeException("An error occurred during JSON parsing", filterStackTrace(t));
}
final Object output;
try {
output = innerHandler.handleRequest(input, context);
} catch (Throwable t) {
throw UnsafeUtil.throwException(filterStackTrace(t));
}
try {
if (outputType.isPresent()) {
PojoSerializer<Object> serializer = getSerializerCached(platform, outputType.get());
serializer.toJson(output, outputStream);
} else {
outputStream.write(_JsonNull);
}
} catch (Throwable t) {
throw new RuntimeException("An error occurred during JSON serialization of response", t);
}
}