-
Bug
-
Resolution: Done
-
Critical
-
None
-
3.6.1.SP2, 3.6.2.Final
-
None
-
None
DefaultValue for param is not processed before first request
This is not a regression against RESTEasy 3.0.24.final or RESTEasy 3.0.16.Final
According to the spec's javadoc:
* By default, when used for injection of parameter values, a selected {@code ParamConverter} * instance MUST be used eagerly by a JAX-RS runtime to convert any {@link DefaultValue * default value} in the resource or provider model, that is during the application deployment, * before any value – default or otherwise – is actually required. * This conversion strategy ensures that any errors in the default values are reported * as early as possible.
DefaultValue annotation can be used like this:
@GET public String testQueryParam(@DefaultValue("INJECTED_ERROR{name=Default,age=42}") @QueryParam("param") ParamDummy param) {
If fromString method of paramConverter class throws exception during the parsing of the default value, this is performed by each request, not before the first request. So previous spec's javadoc doc is violated:
@Provider public class DummyParamConverterProvider implements ParamConverterProvider { @Override public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) { if (rawType.getName().equals(ParamDummy.class.getName())) { return new ParamConverter<T>() { @Override public T fromString(String value) { ... throw new IllegalArgumentException("invalid string " + value); ... } @Override public String toString(T value) { ... } }; } return null; } }
Btw, this behaviour can be changed by @ParamConverter.Lazy annotation, but this annotation is not used in RESTEasy code base at all.
- is blocked by
-
WFLY-11651 Add method parameter check in jaxrs apps
- Closed
-
WFCORE-4297 Add constant to Phase for jaxrs
- Resolved
- is related to
-
RESTEASY-2140 2 integration tests fail due to code changes for RESTEASY-2062
- Resolved