Comments (3)
Yeah, the exception is not the friendliest, because it has occurred during remote lambda invocation, but it is the correct one.
There are no guarantees that the value is not going to be null
, so the code should check for that (and typically create a new instance to update):
this.taskRepository.update(id, myModel -> {
if (myModel == null) {
myModel = new MyModel(id);
}
myModel.setDescription(description);
return myModel;
});
Which can also be done using one of the update
method overloads, which allow you to specify a value supplier that should be used to create a new value instance when the existing value is null
:
this.taskRepository.update(id, MyModel::setDescription, description, MyModel::new);
from coherence-spring.
@aseovic Just revisiting this a bit more. The relevant code is in AbstractRepositoryBase
in Coherence package com.oracle.coherence.repository
:
if (entity == null && factory != null)
{
entity = factory.create(entry.getKey());
}
updater.update(entity, value);
I would think that if the entity is null and the factory is null, an IllegalStateException should be throw, without calling the updater with a null argument causing the nullpointerexception.
from coherence-spring.
Added some documentation explain the situation plus work-around.
from coherence-spring.
Related Issues (20)
- Upgrade Helidon Site Generator Maven Plugin to 3.0.5
- Coherence Spring Session - Add support for persisting sessions without EntryProcessor
- Upgrade Coherence dependency to 23.03.1
- Update Resilience4j Sample for Spring Boot 3
- Add Chapter on Injecting Spring Beans into Coherence-Managed Objects
- Convert CoherenceConfigDataLoaderTests to use Bedrock HOT 1
- Update Coherence dependency to 23.09
- Provide additional documentation on how to setup/configure Coherence Clusters
- Fix failing CI tests HOT 1
- Doc: Provide an appendix that lists all known Coherence Spring Examples/Demos
- Upgrade to Spring Boot 3.2.0 + Spring Framework 6.1.1 HOT 1
- Make sessionIdGenerator configurable
- Link to Quickstart gives 404 error HOT 1
- Coherence Spring Core - use spring-jcl only
- Add Spring Session WAR sample app [3.3.x]
- Add Spring Session WAR sample app [4.1.x]
- Spring Session: Document different way to specify the session timeouts
- Spring Session: Allow for updating existing HTTP Sessions with a new session timeout value
- SessionCreatedEvent not fired correctly HOT 1
- Backport Coherence gRPC Changes to 3.x HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coherence-spring.