Skip to content

Commit

Permalink
修改sonaqube提示的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
entropy-cloud committed Nov 30, 2023
1 parent 89445dc commit 39f7d84
Show file tree
Hide file tree
Showing 325 changed files with 939 additions and 606 deletions.
11 changes: 10 additions & 1 deletion nop-api-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<junit-jupiter.version>5.9.2</junit-jupiter.version>
<slf4j.version>2.0.6</slf4j.version>

<maven.plugin.validation>VERBOSE</maven.plugin.validation>
</properties>

<dependencies>
Expand Down Expand Up @@ -110,10 +111,17 @@
<version>3.3.0</version>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -124,6 +132,7 @@
</executions>
</plugin>
</plugins>

</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public void close() {

IContext context = BaseContextProvider.contextHolder().get();
if (context == this) {
BaseContextProvider.contextHolder().remove();
BaseContextProvider.clear();
}
this.closed = true;
this.attributes.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public IContext currentContext() {
return t_context.get();
}

public static void clear(){
t_context.remove();
}

@Override
public IContext getOrCreateContext() {
IContext context = t_context.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public boolean hasSites(){
}


@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -133,6 +134,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void setPrimary(boolean value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -128,6 +129,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public boolean hasObjs(){
}


@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -78,6 +79,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public boolean hasRoleAuths(){
}


@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -130,6 +131,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void setRoleId(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -156,6 +157,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ public CompletionStage<IUserContext> loginAsync(LoginRequest request, Map<String
errorCode = ERR_AUTH_INVALID_LOGIN_REQUEST;
} else {
user = getAuthUser(request);
if (user == null) {
errorCode = ERR_AUTH_LOGIN_WITH_UNKNOWN_USER;
} else {
if (user != null) {
failCount = userContextCache.getLoginFailCountForUser(user.getUserName());

int maxFailCount = CFG_AUTH_MAX_LOGIN_FAIL_COUNT.get();
Expand All @@ -172,6 +170,9 @@ public CompletionStage<IUserContext> loginAsync(LoginRequest request, Map<String
}

if (errorCode != null || user == null) {
if(errorCode == null)
errorCode = ERR_AUTH_LOGIN_WITH_UNKNOWN_USER;

failCount++;
if (user != null)
userContextCache.setLoginFailCountForUser(user.getUserName(), failCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface SsoConstants {
String JWT_BEARER_CLIENT_ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";

String CLIENT_CREDENTIALS_GRANT = "client_credentials";
String PASSWORD_GRANT = "password";
String PASSWORD_GRANT = "password"; //NOSONAR
String REFRESH_TOKEN_GRANT = "refresh_token";
String REFRESH_TOKEN_VALUE = "refresh_token";

Expand All @@ -34,8 +34,8 @@ public interface SsoConstants {
String INTROSPECTION_TOKEN_USERNAME = "username";
String INTROSPECTION_TOKEN_SUB = "sub";

String PASSWORD_GRANT_USERNAME = "username";
String PASSWORD_GRANT_PASSWORD = "password";
String PASSWORD_GRANT_USERNAME = "username"; //NOSONAR
String PASSWORD_GRANT_PASSWORD = "password"; //NOSONAR

String TOKEN_SCOPE = "scope";
String GRANT_TYPE = "grant_type";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class JWKPublicKeyLocator implements IPublicKeyLocator {

private static final Logger log = LoggerFactory.getLogger(JWKPublicKeyLocator.class);

private volatile ConcurrentMap<String, PublicKey> currentKeys = new ConcurrentHashMap<>();
private volatile ConcurrentHashMap<String, PublicKey> currentKeys = new ConcurrentHashMap<>();

private volatile long lastRequestTime = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ public void destroy(ExtensionContext ctx) {
}

protected void configExecutionMode(TestInfo testInfo) {
if (testInfo.getTestMethod().isEmpty())
Method method = testInfo.getTestMethod().orElse(null);
if (method == null)
return;

EnableSnapshot enableSnapshot = testInfo.getTestMethod().get().getAnnotation(EnableSnapshot.class);
EnableSnapshot enableSnapshot = method.getAnnotation(EnableSnapshot.class);
if (enableSnapshot != null && !CFG_AUTOTEST_DISABLE_SNAPSHOT.get()) {
setCheckOutput(enableSnapshot.checkOutput());
setLocalDb(enableSnapshot.localDb());
Expand Down Expand Up @@ -101,8 +102,11 @@ protected void configExecutionMode(TestInfo testInfo) {
}

protected String getCaseDataPath(TestInfo testInfo) {
Guard.checkArgument(testInfo.getTestMethod().isPresent());
return AutoTestDataHelper.getTestDataPath(testInfo.getTestClass().get(), testInfo.getTestMethod().get());
Class<?> testClass = testInfo.getTestClass().orElse(null);
Method testMethod = testInfo.getTestMethod().orElse(null);
if(testClass == null || testMethod == null)
throw new IllegalArgumentException("null test info");
return AutoTestDataHelper.getTestDataPath(testClass, testMethod);
}

protected void checkEquals(ErrorCode errorCode, String fileName, Object expected, Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ public void accept(EnableVariants enableVariants) {

@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
Guard.checkArgument(context.getTestClass().isPresent());
Guard.checkArgument(context.getTestMethod().isPresent());

Class<?> testClass = context.getTestClass().get();
Method testMethod = context.getTestMethod().get();
Class<?> testClass = context.getTestClass().orElse(null);
Method testMethod = context.getTestMethod().orElse(null);

if(testClass == null || testMethod == null)
throw new IllegalArgumentException("null test info");

String dataDir = AutoTestDataHelper.getTestDataPath(testClass, testMethod);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public void setType(io.nop.core.type.IGenericType value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -236,6 +237,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ public void setType(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -534,6 +535,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void setCacheName(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -76,6 +77,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void setCacheName(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -76,6 +77,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public void setSource(io.nop.core.lang.eval.IEvalAction value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -212,6 +213,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void setTryMethod(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -76,6 +77,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
2 changes: 2 additions & 0 deletions nop-biz/src/main/java/io/nop/biz/model/_gen/_BizModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ public void setWfName(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -318,6 +319,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void setSource(io.nop.core.lang.eval.IEvalAction value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -128,6 +129,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public void setType(io.nop.core.type.IGenericType value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -132,6 +133,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
2 changes: 2 additions & 0 deletions nop-biz/src/main/java/io/nop/biz/model/_gen/_BizTccModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void setConfirmMethod(java.lang.String value){



@Override
public void freeze(boolean cascade){
if(frozen()) return;
super.freeze(cascade);
Expand All @@ -76,6 +77,7 @@ public void freeze(boolean cascade){
}
}

@Override
protected void outputJson(IJsonHandler out){
super.outputJson(out);

Expand Down
Loading

0 comments on commit 39f7d84

Please sign in to comment.