github-advanced-security[bot] commented on code in PR #19468:
URL: https://github.com/apache/druid/pull/19468#discussion_r3254100491
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryVirtualStorageTest.java:
##########
@@ -305,11 +306,12 @@
@Test
void testQuerySysTables()
{
- String query = "SELECT curr_size, max_size, storage_size FROM sys.servers
WHERE tier IS NOT NULL AND server_type = 'historical'";
- Assertions.assertEquals(
- StringUtils.format("%s,%s,%s", SIZE_BYTES, MAX_SIZE, CACHE_SIZE),
- cluster.callApi().runSql(query)
- );
+ final String query = "SELECT curr_size, max_size, storage_size FROM
sys.servers WHERE tier IS NOT NULL AND server_type = 'historical'";
+ final String resultString = cluster.callApi().runSql(query);
+ final String[] split = resultString.split(",");
+ Assertions.assertTrue(Long.parseLong(split[0]) <= SIZE_BYTES);
+ Assertions.assertEquals(MAX_SIZE, Long.parseLong(split[1]));
+ Assertions.assertEquals(CACHE_SIZE, Long.parseLong(split[2]));
Review Comment:
## CodeQL / Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11233)
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryVirtualStorageTest.java:
##########
@@ -305,11 +306,12 @@
@Test
void testQuerySysTables()
{
- String query = "SELECT curr_size, max_size, storage_size FROM sys.servers
WHERE tier IS NOT NULL AND server_type = 'historical'";
- Assertions.assertEquals(
- StringUtils.format("%s,%s,%s", SIZE_BYTES, MAX_SIZE, CACHE_SIZE),
- cluster.callApi().runSql(query)
- );
+ final String query = "SELECT curr_size, max_size, storage_size FROM
sys.servers WHERE tier IS NOT NULL AND server_type = 'historical'";
+ final String resultString = cluster.callApi().runSql(query);
+ final String[] split = resultString.split(",");
+ Assertions.assertTrue(Long.parseLong(split[0]) <= SIZE_BYTES);
+ Assertions.assertEquals(MAX_SIZE, Long.parseLong(split[1]));
Review Comment:
## CodeQL / Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11232)
##########
embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryVirtualStorageTest.java:
##########
@@ -305,11 +306,12 @@
@Test
void testQuerySysTables()
{
- String query = "SELECT curr_size, max_size, storage_size FROM sys.servers
WHERE tier IS NOT NULL AND server_type = 'historical'";
- Assertions.assertEquals(
- StringUtils.format("%s,%s,%s", SIZE_BYTES, MAX_SIZE, CACHE_SIZE),
- cluster.callApi().runSql(query)
- );
+ final String query = "SELECT curr_size, max_size, storage_size FROM
sys.servers WHERE tier IS NOT NULL AND server_type = 'historical'";
+ final String resultString = cluster.callApi().runSql(query);
+ final String[] split = resultString.split(",");
+ Assertions.assertTrue(Long.parseLong(split[0]) <= SIZE_BYTES);
Review Comment:
## CodeQL / Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/11231)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]