github-advanced-security[bot] commented on code in PR #15398:
URL: https://github.com/apache/druid/pull/15398#discussion_r1400447197
##########
extensions-core/google-extensions/src/test/java/org/apache/druid/storage/google/ObjectStorageIteratorTest.java:
##########
@@ -194,70 +191,30 @@
* Makes a mock Google Storage client that handles enough of "List" to test
the functionality of the
* {@link ObjectStorageIterator} class.
*/
- static GoogleStorage makeMockClient(final List<StorageObject> storageObjects)
+ static GoogleStorage makeMockClient(final
List<GoogleStorage.GoogleStorageObjectMetadata> storageObjects)
{
return new GoogleStorage(null)
{
@Override
- public Storage.Objects.List list(final String bucket)
- {
- return mockList(bucket, storageObjects);
- }
- };
- }
-
- @SuppressWarnings("UnnecessaryFullyQualifiedName")
- static class MockStorage extends Storage
- {
- private MockStorage()
- {
- super(
- EasyMock.niceMock(HttpTransport.class),
- EasyMock.niceMock(JsonFactory.class),
- EasyMock.niceMock(HttpRequestInitializer.class)
- );
- }
-
- private MockList mockList(String bucket, java.util.List<StorageObject>
storageObjects)
- {
- return new MockObjects().mockList(bucket, storageObjects);
- }
-
- class MockObjects extends Storage.Objects
- {
- private MockList mockList(String bucket, java.util.List<StorageObject>
storageObjects)
+ public GoogleStorageObjectPage list(
+ final String bucket, final String prefix, final Long pageSize, final
String pageToken
+ )
{
- return new MockList(bucket, storageObjects);
- }
-
- class MockList extends Objects.List
- {
- private final java.util.List<StorageObject> storageObjects;
-
- private MockList(String bucket, java.util.List<StorageObject>
storageObjects)
- {
- super(bucket);
- this.storageObjects = storageObjects;
- }
-
- @Override
- public com.google.api.services.storage.model.Objects execute()
{
// Continuation token is an index in the "objects" list.
- final String continuationToken = getPageToken();
- final int startIndex = continuationToken == null ? 0 :
Integer.parseInt(continuationToken);
+ final int startIndex = pageToken == null ? 0 :
Integer.parseInt(pageToken);
Review Comment:
## Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/5990)
--
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]