@@ -289,30 +289,30 @@ private void checkRule(LinkedHashMap<String, String> row) {
289
289
}
290
290
}
291
291
}
292
- String delayThresholdStr = row .get (COLUMN_DELAY_THRESHOLD );
293
- String heartbeatTimeoutStr = row .get (COLUMN_HEARTBEAT_TIMEOUT );
294
- String heartbeatRetryStr = row .get (COLUMN_HEARTBEAT_RETRY );
295
- if (!StringUtil .isBlank (delayThresholdStr ) && IntegerUtil .parseInt (delayThresholdStr ) < -1 ) {
296
- throw new ConfigException ("Column '" + COLUMN_DELAY_THRESHOLD + "' should be an integer greater than or equal to -1!" );
297
- }
298
- if (!StringUtil .isBlank (heartbeatTimeoutStr ) && IntegerUtil .parseInt (heartbeatTimeoutStr ) < 0 ) {
299
- throw new ConfigException ("Column '" + COLUMN_HEARTBEAT_TIMEOUT + "' should be an integer greater than or equal to 0!" );
300
- }
301
- if (!StringUtil .isBlank (heartbeatRetryStr ) && IntegerUtil .parseInt (heartbeatRetryStr ) < 0 ) {
302
- throw new ConfigException ("Column '" + COLUMN_HEARTBEAT_RETRY + "' should be an integer greater than or equal to 0!" );
303
- }
304
- String heartbeatKeepAliveStr = row .get (COLUMN_KEEP_ALIVE );
305
- if (!StringUtil .isBlank (heartbeatKeepAliveStr ) && IntegerUtil .parseInt (heartbeatKeepAliveStr ) < 0 ) {
306
- throw new ConfigException ("Column '" + COLUMN_KEEP_ALIVE + "' should be an integer greater than or equal to 0!" );
307
- }
308
- String delayPeriodMillis = row .get (DELAY_PERIOD_MILLIS );
309
- delayDetectionCheck (delayPeriodMillis );
292
+ checkInterValue (row );
310
293
}
311
294
}
312
295
313
- private void delayDetectionCheck (String delayPeriodMillis ) {
314
- if (!StringUtil .isBlank (delayPeriodMillis ) && IntegerUtil .parseInt (delayPeriodMillis ) < -1 ) {
315
- throw new ConfigException ("Column '" + COLUMN_DELAY_THRESHOLD + "' should be an integer greater than -1!" );
296
+ private void checkInterValue (LinkedHashMap <String , String > row ) {
297
+ String delayThresholdStr = row .get (COLUMN_DELAY_THRESHOLD );
298
+ String heartbeatTimeoutStr = row .get (COLUMN_HEARTBEAT_TIMEOUT );
299
+ String heartbeatRetryStr = row .get (COLUMN_HEARTBEAT_RETRY );
300
+ if (row .containsKey (COLUMN_DELAY_THRESHOLD ) && (StringUtil .isBlank (delayThresholdStr ) || IntegerUtil .parseInt (delayThresholdStr ) < -1 )) {
301
+ throw new ConfigException ("Column '" + COLUMN_DELAY_THRESHOLD + "' should be an integer greater than or equal to -1!" );
302
+ }
303
+ if (row .containsKey (COLUMN_HEARTBEAT_TIMEOUT ) && (StringUtil .isBlank (heartbeatTimeoutStr ) || IntegerUtil .parseInt (heartbeatTimeoutStr ) < 0 )) {
304
+ throw new ConfigException ("Column '" + COLUMN_HEARTBEAT_TIMEOUT + "' should be an integer greater than or equal to 0!" );
305
+ }
306
+ if (row .containsKey (COLUMN_HEARTBEAT_RETRY ) && (StringUtil .isBlank (heartbeatRetryStr ) || IntegerUtil .parseInt (heartbeatRetryStr ) < 0 )) {
307
+ throw new ConfigException ("Column '" + COLUMN_HEARTBEAT_RETRY + "' should be an integer greater than or equal to 0!" );
308
+ }
309
+ String heartbeatKeepAliveStr = row .get (COLUMN_KEEP_ALIVE );
310
+ if (row .containsKey (COLUMN_KEEP_ALIVE ) && (StringUtil .isBlank (heartbeatKeepAliveStr ) || IntegerUtil .parseInt (heartbeatKeepAliveStr ) < 0 )) {
311
+ throw new ConfigException ("Column '" + COLUMN_KEEP_ALIVE + "' should be an integer greater than or equal to 0!" );
312
+ }
313
+ String delayPeriodMillis = row .get (DELAY_PERIOD_MILLIS );
314
+ if (row .containsKey (DELAY_PERIOD_MILLIS ) && (StringUtil .isBlank (delayPeriodMillis ) || IntegerUtil .parseInt (delayPeriodMillis ) < -1 )) {
315
+ throw new ConfigException ("Column '" + DELAY_PERIOD_MILLIS + "' should be an integer greater than or equal to -1!" );
316
316
}
317
317
}
318
318
0 commit comments