PDGGK opened a new issue, #38151:
URL: https://github.com/apache/shardingsphere/issues/38151

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   master (latest)
   
   ### Which project did you use? ShardingSphere-Proxy or ShardingSphere-JDBC?
   ShardingSphere-Proxy
   
   ### Expected behavior
   ZooKeeper configuration properties (retryIntervalMilliseconds, maxRetries, 
timeToLiveSeconds, operationTimeoutMilliseconds) should be parsed correctly 
regardless of whether they are stored as String or Integer values.
   
   ### Actual behavior
   `StatisticsCollectJobWorker.getZookeeperConfiguration()` uses `(int) 
props.get(...)` to read properties. When properties come from YAML 
configuration or URL parameters, they are stored as Strings (e.g., `"500"` 
instead of `500`), causing a `ClassCastException: java.lang.String cannot be 
cast to java.lang.Integer`.
   
   ### Reason analyze
   `Properties` extends `Hashtable<Object, Object>`. Values loaded from YAML 
config or URL query parameters (via `ShardingSphereURL`) are always Strings. 
The direct `(int)` cast assumes Integer objects.
   
   **Affected lines in `StatisticsCollectJobWorker.java`:**
   - Line 91: `(int) props.get("retryIntervalMilliseconds")`
   - Line 92: `(int) props.get("maxRetries")`
   - Line 96: `(int) props.get("timeToLiveSeconds")`
   - Line 100: `(int) props.get("operationTimeoutMilliseconds")`
   
   ### Steps to reproduce
   Configure ShardingSphere-Proxy with ZooKeeper mode using YAML configuration 
that includes numeric properties as strings (which is the default YAML parsing 
behavior).
   
   ### Fix
   Use `Integer.parseInt(props.get(...).toString())` to safely handle both 
String and Integer property values.


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