@@ -425,46 +425,37 @@ else if (this.flush) {
425425 * @return Either the number of affected entities when using a JPQL query.
426426 * When using a merge/persist the updated/inserted itself is returned.
427427 */
428- public Object executeOutboundJpaOperation (final Message <?> message ) {
429-
430- final Object result ;
431-
428+ public Object executeOutboundJpaOperation (Message <?> message ) {
432429 ParameterSource paramSource = null ;
433430 if (this .jpaQuery != null || this .nativeQuery != null || this .namedQuery != null ) {
434431 paramSource = determineParameterSource (message );
435432 }
436433 if (this .jpaQuery != null ) {
437- result = this .jpaOperations .executeUpdate (this .jpaQuery , paramSource );
434+ return this .jpaOperations .executeUpdate (this .jpaQuery , paramSource );
438435 }
439436 else if (this .nativeQuery != null ) {
440- result = this .jpaOperations .executeUpdateWithNativeQuery (this .nativeQuery , paramSource );
437+ return this .jpaOperations .executeUpdateWithNativeQuery (this .nativeQuery , paramSource );
441438 }
442439 else if (this .namedQuery != null ) {
443- result = this .jpaOperations .executeUpdateWithNamedQuery (this .namedQuery , paramSource );
440+ return this .jpaOperations .executeUpdateWithNamedQuery (this .namedQuery , paramSource );
444441 }
445442 else {
446443 switch (this .persistMode ) {
447444 case PERSIST :
448445 this .jpaOperations .persist (message .getPayload (), this .flushSize , this .clearOnFlush );
449- result = message .getPayload ();
450- break ;
446+ return message .getPayload ();
451447 case MERGE :
452- result = this .jpaOperations .merge (message .getPayload (), this .flushSize , this .clearOnFlush );
453- break ;
448+ return this .jpaOperations .merge (message .getPayload (), this .flushSize , this .clearOnFlush );
454449 case DELETE :
455450 this .jpaOperations .delete (message .getPayload ());
456451 if (this .flush ) {
457452 this .jpaOperations .flush ();
458453 }
459- result = message .getPayload ();
460- break ;
454+ return message .getPayload ();
461455 default :
462456 throw new IllegalStateException ("Unsupported PersistMode: " + this .persistMode .name ());
463457 }
464458 }
465-
466- return result ; // NOSONAR never null
467-
468459 }
469460
470461 /**
@@ -496,6 +487,7 @@ public Object poll(@Nullable final Message<?> requestMessage) {
496487 if (entityClazz == null && requestMessage != null ) {
497488 entityClazz = requestMessage .getPayload ().getClass ();
498489 }
490+ Assert .state (entityClazz != null , "The entity class to retrieve cannot be null." );
499491 payload = this .jpaOperations .find (entityClazz , id );
500492 }
501493 else {
0 commit comments