Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method name into "RequestParam.value() was empty on parameter" exception message #938

Closed
wants to merge 1 commit into from

Conversation

stsypanov
Copy link
Contributor

Currently when RequestParam's name is missing we get this exception:

Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
	at feign.Util.checkState(Util.java:136) ~[feign-core-11.10.jar:na]
	at org.springframework.cloud.openfeign.annotation.RequestParamParameterProcessor.processArgument(RequestParamParameterProcessor.java:63) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at org.springframework.cloud.openfeign.support.SpringMvcContract.processAnnotationsOnParameter(SpringMvcContract.java:298) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:126) ~[feign-core-11.10.jar:na]
	at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:197) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:65) ~[feign-core-11.10.jar:na]
	at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:151) ~[feign-core-11.10.jar:na]
	at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:49) ~[feign-core-11.10.jar:na]
	at feign.Feign$Builder.target(Feign.java:205) ~[feign-core-11.10.jar:na]
	at org.springframework.cloud.openfeign.DefaultTargeter.target(DefaultTargeter.java:30) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:451) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:402) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at org.springframework.cloud.openfeign.FeignClientsRegistrar.lambda$registerFeignClient$0(FeignClientsRegistrar.java:235) ~[spring-cloud-openfeign-core-3.1.8.jar:3.1.8]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1249) ~[spring-beans-5.3.30.jar:5.3.30]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191) ~[spring-beans-5.3.30.jar:5.3.30]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.30.jar:5.3.30]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.30.jar:5.3.30]
	... 28 common frames omitted

From exception message it's hard to understand which method is broken. This PR aims to fix this by adding failed method's name.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Merging #938 (a971322) into main (ca4de4e) will increase coverage by 0.00%.
Report is 8 commits behind head on main.
The diff coverage is 50.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #938   +/-   ##
=========================================
  Coverage     77.12%   77.13%           
  Complexity      583      583           
=========================================
  Files            71       71           
  Lines          2299     2300    +1     
  Branches        308      308           
=========================================
+ Hits           1773     1774    +1     
  Misses          357      357           
  Partials        169      169           
Files Coverage Δ
...ign/annotation/RequestParamParameterProcessor.java 94.44% <50.00%> (+0.32%) ⬆️

@OlgaMaciaszek OlgaMaciaszek added this to the 3.1.9 milestone Dec 1, 2023
Copy link
Collaborator

@OlgaMaciaszek OlgaMaciaszek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @stsypanov. LGTM.

@OlgaMaciaszek
Copy link
Collaborator

Merged within 88293e4.

@stsypanov stsypanov deleted the add-method-name branch December 4, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants