gnodet-bot commented on code in PR #30815:
URL: https://github.com/apache/camel/pull/30815#discussion_r4703436740


##########
components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java:
##########
@@ -79,6 +83,13 @@ public SmppConsumer(SmppEndpoint endpoint, SmppConfiguration 
config, Processor p
             }
 
             if (newState.equals(SessionState.UNBOUND) || 
newState.equals(SessionState.CLOSED)) {
+                if (source == bindingSession.get()) {

Review Comment:
   🔒 **Defensive null guard:** `bindingSession.get()` returns `null` when no 
session is being bound on the current thread (the default ThreadLocal value). 
If jsmpp ever calls the listener with `source = null`, the check `null == null` 
would match, causing a session loss to be silently ignored instead of 
triggering reconnect.
   
   The existing unit tests previously used `null` as the `source` argument 
(changed to `session` by this PR), which shows the scenario is not purely 
theoretical. Adding an explicit null check eliminates the ambiguity:
   
   ```suggestion
                   if (source != null && source == bindingSession.get()) {
   ```



##########
components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java:
##########
@@ -75,6 +79,13 @@ public SmppProducer(SmppEndpoint endpoint, SmppConfiguration 
config) {
             }
 
             if (newState.equals(SessionState.UNBOUND) || 
newState.equals(SessionState.CLOSED)) {
+                if (source == bindingSession.get()) {

Review Comment:
   🔒 **Defensive null guard:** Same concern as `SmppConsumer` — `source = null` 
would match `bindingSession.get()` when the ThreadLocal is empty, silently 
skipping reconnect for a session that was never the binding one.
   
   ```suggestion
                   if (source != null && source == bindingSession.get()) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to