dragonorant opened a new issue #15034:
URL: https://github.com/apache/shardingsphere/issues/15034


   ```text
    <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
       <version>5.0.0</version>
   </dependency>
   ```
   
   ```yml
         sharding:
           tables:
             sanyi_account:
               actual-data-nodes: master.sanyi_account_$->{0..0}
               table-strategy:
                 standard:
                   sharding-column: account_id
                   sharding-algorithm-name: account-inline
             sanyi_account_short:
               actual-data-nodes: master.sanyi_account_short_$->{0..0}
               table-strategy:
                 standard:
                   sharding-column: short_id
                   sharding-algorithm-name: short-inline
           sharding-algorithms:
             account-inline:
               type: MOD
               props:
                 sharding-count: 1
             short-inline:
               type: HASH_MOD
               props:
                 sharding-count: 1
   ```
   
   exception 
   ```text
   Caused by: java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:542)
        at java.lang.Integer.parseInt(Integer.java:615)
        at 
org.apache.shardingsphere.sharding.algorithm.sharding.mod.HashModShardingAlgorithm.getShardingCount(HashModShardingAlgorithm.java:52)
   ```
   
   ```java
     HashModShardingAlgorithm.class
      private int getShardingCount() {
           Preconditions.checkArgument(props.containsKey(SHARDING_COUNT_KEY), 
"Sharding count cannot be null.");
   // Presentation of exception
           return Integer.parseInt(props.getProperty(SHARDING_COUNT_KEY));
       }
   
   Properties.class
   // underlying code
       public String getProperty(String key) {
           Object oval = super.get(key);
           String sval = (oval instanceof String) ? (String)oval : null;
           return ((sval == null) && (defaults != null)) ? 
defaults.getProperty(key) : sval;
       }
   
   // mod no problem
   ModShardingAlgorithm.class
   private int getShardingCount() {
           Preconditions.checkArgument(props.containsKey(SHARDING_COUNT_KEY), 
"Sharding count cannot be null.");
           return Integer.parseInt(props.get(SHARDING_COUNT_KEY).toString());
       }
   ```
   
   
   


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