aliyun / aliyun/aliyun-openapi-java-sdk

DefaultProfile inconsistent behavior

Open
#966 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

  • Product and API: KMS, SecretManagerClient
  • Platform: Java
  • Mininum Code:
            DefaultProfile profile = DefaultProfile.getProfile(region);
            profile.setCloseTrace(true);
            SecretManagerClient secretManagerClient =
                    BaseSecretManagerClientBuilder.standard()
                            .withCredentialsProvider(
                                    createCredentialsProvider(assumeRoleArn, region))
                            .withRegion(region)
                            .build();
            return SecretCacheClientBuilder.newCacheClientBuilder(secretManagerClient).build();

I noticed a potential inconsistency in the DefaultProfile class, particularly in lines 70-72:
https://github.com/aliyun/aliyun-openapi-java-sdk/blob/01ed0d01d6ea83f260ac690b3b8a6a088d6ae0df/aliyun-java-sdk-core/src/main/java/com/aliyuncs/profile/DefaultProfile.java#L70-L72

Most of the getProfile methods assign a new DefaultProfile instance to the profile variable, but one method does not follow this pattern. This discrepancy could impact clients relying on this profile, potentially leading to issues like inconsistent trace disabling behavior. Could you clarify if this is the intended behavior or if it might be a bug?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with aliyun-java-sdk-core/src/main/java/com/aliyuncs/profile/DefaultProfile.java, especially lines 70-72, and compare that method with the other getProfile methods. Trace how the returned profile is used by SecretManagerClient and determine whether the differing assignment changes trace configuration; done means the intended behavior and any required correction are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.