Skip to content

Commit 9488fdf

Browse files
committed
Fix new Sonar issues
1 parent 0ef8dc5 commit 9488fdf

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.springframework.integration.jpa.support.JpaUtils;
3131
import org.springframework.integration.jpa.support.parametersource.ParameterSource;
3232
import org.springframework.integration.jpa.support.parametersource.PositionSupportingParameterSource;
33+
import org.springframework.lang.Nullable;
3334
import org.springframework.util.Assert;
3435
import org.springframework.util.StringUtils;
3536

@@ -226,6 +227,7 @@ public void persist(Object entity, int flushSize, boolean clearOnFlush) {
226227
persistOrMerge(entity, false, flushSize, clearOnFlush);
227228
}
228229

230+
@Nullable
229231
private Object persistOrMerge(Object entity, boolean isMerge, int flushSize, boolean clearOnFlush) {
230232
Object result = null;
231233

spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ else if (this.namedQuery != null) {
472472
* Execute the JPA operation. Delegates to {@link JpaExecutor#poll(Message)}.
473473
* @return The object or null.
474474
*/
475+
@Nullable
475476
public Object poll() {
476477
return poll(null);
477478
}
@@ -485,6 +486,7 @@ public Object poll() {
485486
* @param requestMessage May be null.
486487
* @return The payload object, which may be null.
487488
*/
489+
@Nullable
488490
public Object poll(@Nullable final Message<?> requestMessage) {
489491
final Object payload;
490492

@@ -508,8 +510,8 @@ public Object poll(@Nullable final Message<?> requestMessage) {
508510
if (this.firstResultExpression != null) {
509511
firstResult = getFirstResult(requestMessage);
510512
}
511-
ParameterSource parameterSource = determineParameterSource(requestMessage);
512-
result = doPoll(parameterSource, firstResult, maxNumberOfResults);
513+
ParameterSource paramSource = determineParameterSource(requestMessage);
514+
result = doPoll(paramSource, firstResult, maxNumberOfResults);
513515
}
514516

515517
if (result.isEmpty()) {
@@ -535,6 +537,11 @@ else if (requestMessage != null) {
535537
}
536538
}
537539

540+
checkDelete(payload);
541+
return payload;
542+
}
543+
544+
private void checkDelete(final Object payload) {
538545
if (payload != null && this.deleteAfterPoll) {
539546
if (payload instanceof Iterable) {
540547
if (this.deleteInBatch) {
@@ -554,7 +561,6 @@ else if (requestMessage != null) {
554561
this.jpaOperations.flush();
555562
}
556563
}
557-
return payload;
558564
}
559565

560566
protected List<?> doPoll(ParameterSource jpaQLParameterSource, int firstResult, int maxNumberOfResults) {

0 commit comments

Comments
 (0)