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

/collection/{slug}: EmptyResultDataAccessException with not existing id #449

Closed
php-coder opened this issue Aug 18, 2016 · 4 comments
Closed
Assignees
Milestone

Comments

@php-coder
Copy link
Owner

When I open not existing collection /collection/10/foo I should get 404 error, but currently I see 500:

Aug 18 23:56:04 my-stamps.ru java[21650]: Caused by: org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.dao.support.DataAccessUtils.requiredSingleResult(DataAccessUtils.java:71)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:212)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:219)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at ru.mystamps.web.dao.impl.JdbcCollectionDao.findCollectionInfoById(JdbcCollectionDao.java:176)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at ru.mystamps.web.service.CollectionServiceImpl.findById(CollectionServiceImpl.java:153)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at java.lang.reflect.Method.invoke(Method.java:498)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at com.sun.proxy.$Proxy57.findById(Unknown Source)
Aug 18 23:56:04 my-stamps.ru java[21650]:         at ru.mystamps.web.controller.CollectionController.showInfo(CollectionController.java:66)
@php-coder php-coder added this to the 0.4 milestone Aug 18, 2016
@php-coder php-coder changed the title /collection/{id}/{slug}: EmptyResultDataAccessException with not existing id /collection/{slug}: EmptyResultDataAccessException with not existing id Aug 18, 2016
@php-coder
Copy link
Owner Author

php-coder commented Aug 22, 2016

In addition to the fix I would like to have an integration test for that case.

Hints:

@php-coder
Copy link
Owner Author

@bodom91 This will be your next task.

@bodom91
Copy link
Contributor

bodom91 commented Aug 23, 2016

My Solution bodom91@d2f0d9b

But im not sure about InfoCollectionPage and now i dont have idea, sorry ...((

@php-coder
Copy link
Owner Author

But im not sure about InfoCollectionPage and now i dont have idea, sorry ...((

Ah, I see now that we don't need it. I'm sorry, I've updated the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants