Skip to content

Migrating from JClouds OS to AliCloud OS - #1956

Open
karrgov wants to merge 1 commit into
masterfrom
alicloud_migration
Open

karrgov wants to merge 1 commit into
masterfrom
alicloud_migration

Conversation

@karrgov

@karrgov karrgov commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Migrating from JClouds OS to AliCloud OS

LMCROSSITXSADEPLOY-3312

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
75.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Comment on lines +70 to +71
String region = ((String) credentials.get(CredentialKeys.REGION)).substring(
4); // so we can remove the "oss-" part, because it does not work with V4 signing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we receive something other than oss- this will break. Can you use replace("oss-", "")

Comment on lines +76 to +79
config.setConnectionTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_CONNECTION_TIMEOUT_CONFIG_IN_SECONDS.toMillis());
config.setSocketTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_SOCKET_TIMEOUT_CONFIG_IN_MINUTES.toMillis());
config.setRequestTimeoutEnabled(true);
config.setRequestTimeout((int) ObjectStoreConstants.ALI_OBJECT_STORE_REQUEST_TIMEOUT_CONFIG_IN_MINUTES.toMillis());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MiscUtil.cast

LOGGER.debug(MessageFormat.format(Messages.DELETED_FILE_WITH_ID_0_AND_SPACE_1, id, space));
} catch (OSSException | ClientException e) {
LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_OPERATION_0_FAILED_FOR_KEY_1, "deleteObject", id, describe(e)));
throw e;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw FileStorageException not the incomming one

} catch (OSSException | ClientException e) {
LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_CONNECTION_TEST_FAILED_FOR_BUCKET_0_ENDPOINT_1, bucketName,
endpoint, describe(e)));
throw e;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw FileStorageException

ossObject = ossClient.getObject(request);
} catch (OSSException | ClientException e) {
LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_OPERATION_0_FAILED_FOR_KEY_1, "getObject", id, describe(e)));
throw e;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw FileStorageException

} while (listing.isTruncated());
} catch (OSSException | ClientException e) {
LOGGER.error(MessageFormat.format(Messages.ALI_OBJECT_STORE_LISTING_FAILED_FOR_BUCKET_0, bucketName, describe(e)));
throw e;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw FileStorageException

Comment on lines +115 to +119
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(fileSize);
metadata.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
metadata.setContentDisposition(fileEntry.getName());
metadata.setUserMetadata(ObjectStoreMapper.createFileEntryMetadata(fileEntry));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would separate it to a new method because this a long method

Comment on lines +276 to +282
.map(objectSummary -> CompletableFuture.supplyAsync(() -> fetchMetadataAndFilter(objectSummary.getKey(), predicate),
executor))
.toList()
.stream()
.map(CompletableFuture::join)
.filter(Objects::nonNull)
.toList();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why dont you do the second map right after the first one instead calling toList?

Comment on lines +337 to +342
try {
do {
listing = ossClient.listObjects(request);
pageConsumer.accept(listing.getObjectSummaries());
request.setMarker(listing.getNextMarker());
} while (listing.isTruncated());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate the do-while in a new method because there are nested structures.

P.S wow, haven't seen do-while in a while. no pun intended :D

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants