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

Signed-off-by: Haotian Zhang <928016560@qq.com>
Haotian Zhang 3 weeks ago committed by GitHub
parent 2a5952bc42
commit 0168b44f5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,4 +30,5 @@
- [fix: tsf gateway config support tsf-data-access.](https://github.com/Tencent/spring-cloud-tencent/pull/1745)
- [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 nacos service discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1752)
- [fix: fix nacos service discovery.](https://github.com/Tencent/spring-cloud-tencent/pull/1752)
- [fix:fix NPE when rate-limiting with null value.](https://github.com/Tencent/spring-cloud-tencent/pull/1763)

@ -74,7 +74,7 @@
<revision>2.1.0.3-2021.0.9-SNAPSHOT</revision>
<!-- Polaris SDK version -->
<polaris.version>2.1.0.2</polaris.version>
<polaris.version>2.1.0.3-SNAPSHOT</polaris.version>
<!-- Dependencies -->
<bcpkix-jdk18on.version>1.78.1</bcpkix-jdk18on.version>

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

@ -85,9 +85,9 @@ public class QuickstartCalleeController {
* @return information of callee
*/
@GetMapping("/info")
public String info() {
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties);
public String info(@RequestParam(required = false) String param) {
LOG.info("Quickstart [{}] Service [{}:{}] is called with param [{}]. datasource = [{}].", appName, ip, port, param, 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);
}
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);
LOG.info(result);
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);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@ -147,12 +147,12 @@ public class QuickstartCalleeController {
return new ResponseEntity<>(result, HttpStatus.BAD_GATEWAY);
}
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);
LOG.info(result);
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);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@ -198,7 +198,7 @@ public class QuickstartCalleeController {
LOG.info(result);
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);
return new ResponseEntity<>(result, HttpStatus.OK);
}

Loading…
Cancel
Save