fix:fix NPE when rate-limiting with null value. (#1764)

Signed-off-by: Haotian Zhang <928016560@qq.com>
pull/1769/head
Haotian Zhang 2 weeks ago
parent 1718c5c92c
commit b2faadeb52

@ -34,3 +34,4 @@
- [fix: fix multiple bugs in tsf.](https://github.com/Tencent/spring-cloud-tencent/pull/1746) - [fix: fix multiple bugs in tsf.](https://github.com/Tencent/spring-cloud-tencent/pull/1746)
- [fix: fix get gateway config in tsf ipv6.](https://github.com/Tencent/spring-cloud-tencent/pull/1747) - [fix: fix get gateway config in tsf ipv6.](https://github.com/Tencent/spring-cloud-tencent/pull/1747)
- [fix: fix nacos service discovery. ](https://github.com/Tencent/spring-cloud-tencent/pull/1751) - [fix: fix nacos service discovery. ](https://github.com/Tencent/spring-cloud-tencent/pull/1751)
- [fix:fix NPE when rate-limiting with null value.](https://github.com/Tencent/spring-cloud-tencent/pull/1764)

@ -74,7 +74,7 @@
<revision>2.1.0.1-2023.0.6-SNAPSHOT</revision> <revision>2.1.0.1-2023.0.6-SNAPSHOT</revision>
<!-- Polaris SDK version --> <!-- Polaris SDK version -->
<polaris.version>2.1.0.2-SNAPSHOT</polaris.version> <polaris.version>2.1.0.3-SNAPSHOT</polaris.version>
<!-- Dependencies --> <!-- Dependencies -->
<springdoc.version>2.8.13</springdoc.version> <springdoc.version>2.8.13</springdoc.version>

@ -87,9 +87,9 @@ public class QuickstartCalleeController {
* @return information of callee * @return information of callee
*/ */
@GetMapping("/info") @GetMapping("/info")
public String info() { public String info(@RequestParam(required = false) String param) {
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties); LOG.info("Quickstart [{}] Service [{}:{}] is called with param [{}]. datasource = [{}].", appName, ip, port, param, dataSourceProperties);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties); return String.format("Quickstart [%s] Service [%s:%s] is called with param [%s]. datasource = [%s].", appName, ip, port, param, dataSourceProperties);
} }
@PostMapping("/user") @PostMapping("/user")

@ -85,9 +85,9 @@ public class QuickstartCalleeController {
* @return information of callee * @return information of callee
*/ */
@GetMapping("/info") @GetMapping("/info")
public String info() { public String info(@RequestParam(required = false) String param) {
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties); LOG.info("Quickstart [{}] Service [{}:{}] is called with param [{}]. datasource = [{}].", appName, ip, port, param, dataSourceProperties);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties); return String.format("Quickstart [%s] Service [%s:%s] is called with param [%s]. datasource = [%s].", appName, ip, port, param, dataSourceProperties);
} }
/** /**
@ -124,12 +124,12 @@ public class QuickstartCalleeController {
return new ResponseEntity<>(result, HttpStatus.BAD_GATEWAY); return new ResponseEntity<>(result, HttpStatus.BAD_GATEWAY);
} }
if (delay > 0) { if (delay > 0) {
String result = String.format("Quickstart Callee Service [%s:%s] is called after %sms.", ip, port, delay); String result = String.format("Quickstart Callee Service [%s:%s] is called after %sms.", ip, port, delay);
Thread.sleep(delay); Thread.sleep(delay);
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
String result = String.format("Quickstart Callee Service [%s:%s] is called right.", ip, port); String result = String.format("Quickstart Callee Service [%s:%s] is called right.", ip, port);
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@ -147,12 +147,12 @@ public class QuickstartCalleeController {
return new ResponseEntity<>(result, HttpStatus.BAD_GATEWAY); return new ResponseEntity<>(result, HttpStatus.BAD_GATEWAY);
} }
if (delay > 0) { if (delay > 0) {
String result = String.format("Quickstart Callee Service uid %s [%s:%s] is called after %sms.", uid, ip, port, delay); String result = String.format("Quickstart Callee Service uid %s [%s:%s] is called after %sms.", uid, ip, port, delay);
Thread.sleep(delay); Thread.sleep(delay);
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
String result = String.format("Quickstart Callee Service uid %s [%s:%s] is called right.", uid, ip, port); String result = String.format("Quickstart Callee Service uid %s [%s:%s] is called right.", uid, ip, port);
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@ -198,7 +198,7 @@ public class QuickstartCalleeController {
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
String result = String.format("Quickstart Callee Service [%s:%s] is detected right.", ip, port); String result = String.format("Quickstart Callee Service [%s:%s] is detected right.", ip, port);
LOG.info(result); LOG.info(result);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }

Loading…
Cancel
Save