spring-projects / spring-projects/spring-data-rest
PATCH returns NPE when it should be a not found [DATAREST-529]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
type: bug
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Luan Nguyen opened DATAREST-529 and commented
Line 156 of PersistentEntityResourceHandlerMethodArgumentResolver.java possibly missed a "throw" statement. I.e. it should be "throw new ResourceNotFoundException();" instead of just "new ResourceNotFoundException();"
Test case:
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public interface PersonRepository extends PagingAndSortingRepository<Person, Long> {
}
curl -H "Content-Type: application/json" -X PATCH -d '{"name": "John Doe"}' localhost:8080/persons/1000
{"timestamp":1430770675151,"status":500,"error":"Internal Server Error","exception":"java.lang.NullPointerException","message":"No message available"}
No further details from DATAREST-529
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.