jason810496 opened a new pull request, #68433:
URL: https://github.com/apache/airflow/pull/68433

   ## Why
   
   @vatsrahul1001 ran into this error when setting up connection with port in 
Java-SDK. For example setting `AIRFLOW_CONN_TEST_HTTP='{"conn_type": "http", 
"login": "user", "password": "pass", "host": "example.com", "port": 1234, 
"extra": {"param1": "val1", "param2": "val2"}}'` in breeze we will get:
   
   ```
   [2026-06-11 14:44:12] DEBUG - Connected logs addr=/127.0.0.1:56941
   [2026-06-11 14:44:12] DEBUG - Connected comm addr=/127.0.0.1:40867
   [2026-06-11 14:44:13] DEBUG - Handling id=0
   [2026-06-11 14:44:13] ERROR - [main] INFO 
org.apache.airflow.example.AnnotationExample - Hello from task
   [2026-06-11 14:44:13] DEBUG - Sending id=0 
body=org.apache.airflow.sdk.execution.comm.GetXCom@72ea6193[key=return_value,dagId=java_annotation_example,runId=manual__2026-06-11T09:14:11.101516+00:00,taskId=python_task_1,mapIndex=<null>,includePriorDates=false,type=GetXCom]
   [2026-06-11 14:44:13] DEBUG - Handling id=0
   [2026-06-11 14:44:13] ERROR - [main] INFO 
org.apache.airflow.example.AnnotationExample - Got XCom from Python Task 
'python_task_1' value_from_python_task_1
   [2026-06-11 14:44:13] DEBUG - Sending id=1 
body=org.apache.airflow.sdk.execution.comm.GetConnection@698122b2[connId=test_http,type=GetConnection]
   [2026-06-11 14:44:13] DEBUG - Handling id=1
   [2026-06-11 14:44:13] ERROR - Error executing task 
ti=org.apache.airflow.sdk.execution.comm.TaskInstanceDTO@13cf7d52[id=019eb5f5-e328-7e25-8784-591f08ba329a,dagVersionId=019eb5d5-63b2-7d13-b8d9-b088827410a0,taskId=extract,dagId=java_annotation_example,runId=manual__2026-06-11T09:14:11.101516+00:00,tryNumber=1,mapIndex=-1,poolSlots=1,queue=java,priorityWeight=3,parentContextCarrier=<null>,contextCarrier={traceparent=00-236f21095f7ed4196bdb938d71f41dac-812162b32d6c7f78-01}]
 error=java.lang.ClassCastException: class java.lang.Long cannot be cast to 
class java.lang.Integer (java.lang.Long and java.lang.Integer are in module 
java.base of loader 'bootstrap') trace=java.lang.ClassCastException: class 
java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and 
java.lang.Integer are in module java.base of loader 'bootstrap')
        at org.apache.airflow.sdk.Client.getConnection(Client.kt:82)
        at 
org.apache.airflow.example.AnnotationExample.extractValue(AnnotationExample.java:39)
        at 
org.apache.airflow.example.AnnotationExampleBuilder$ExtractValue.execute(AnnotationExampleBuilder.java:23)
        at org.apache.airflow.sdk.execution.TaskRunner.runTask$sdk(Task.kt:66)
        at org.apache.airflow.sdk.execution.TaskKt.runTask(Task.kt:80)
        at 
org.apache.airflow.sdk.execution.CoordinatorComm.handleIncoming(Comm.kt:105)
        at 
org.apache.airflow.sdk.execution.CoordinatorComm$startProcessing$2.invoke(Comm.kt:62)
        at 
org.apache.airflow.sdk.execution.CoordinatorComm$startProcessing$2.invoke(Comm.kt:62)
        at 
org.apache.airflow.sdk.execution.CoordinatorComm.processOnce(Comm.kt:87)
        at 
org.apache.airflow.sdk.execution.CoordinatorComm.startProcessing(Comm.kt:62)
        at 
org.apache.airflow.sdk.Server$serveAsync$2$1.invokeSuspend(Server.kt:149)
        at 
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
        at 
kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at 
kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at org.apache.airflow.sdk.execution.LogSender.sendTo(Logger.kt:112)
        at org.apache.airflow.sdk.execution.LogSender.configure(Logger.kt:88)
        at 
org.apache.airflow.sdk.Server$serveAsync$2$2.invokeSuspend(Server.kt:155)
        at 
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
        at 
kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:94)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:70)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at 
kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at org.apache.airflow.sdk.Server.serve(Server.kt:121)
        at 
org.apache.airflow.example.ExampleBundleBuilder.main(ExampleBundleBuilder.java:35)
   [2026-06-11 14:44:13] ERROR - java.lang.ClassCastException: class 
java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and 
java.lang.Integer are in module java.base of loader 'bootstrap')
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.Client.getConnection(Client.kt:82)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.example.AnnotationExample.extractValue(AnnotationExample.java:39)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.example.AnnotationExampleBuilder$ExtractValue.execute(AnnotationExampleBuilder.java:23)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.TaskRunner.runTask$sdk(Task.kt:66)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.TaskKt.runTask(Task.kt:80)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.CoordinatorComm.handleIncoming(Comm.kt:105)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.CoordinatorComm$startProcessing$2.invoke(Comm.kt:62)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.CoordinatorComm$startProcessing$2.invoke(Comm.kt:62)
   [2026-06-11 14:44:13] ERROR -        at 
org.apache.airflow.sdk.execution.CoordinatorComm.processOnce(Comm.kt:87)
   ```
   
   ## What
   
   - Fix the `Long` to `Int` casting error at Java-SDK connection client side
   - Fill the Java-SDK e2e test gap by using connection with all the available 
fields (`port`, `extra`, `conn_type`) etc.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [x] Yes, with help of Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
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