Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-31617: Sonar Fixes #1537

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class RefreshController {

@GetMapping("/refresh")
public Map<String, String> refreshContext(@RequestParam("servicename") String serviceName) {
logger.info("refreshContext invoked with serviceName : {}", serviceName);
logger.info("refreshContext invoked with (sanitized) serviceName : {}", serviceName.replaceAll("[\n\r\t]", "_"));
Map<String, String> result = new HashMap<>();

if(Objects.nonNull(discoveryClient)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,19 @@
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

import io.mosip.kernel.vidgenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.idgenerator.constant.HibernatePersistenceConstant;
import jakarta.persistence.EntityManagerFactory;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import io.mosip.kernel.uingenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.idgenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.uingenerator.constant.UINHealthConstants;
import io.mosip.kernel.uingenerator.constant.UinGeneratorConstant;
import io.netty.handler.codec.http.HttpResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
*
*/
package io.mosip.kernel.uingenerator.constant;
package io.mosip.kernel.idgenerator.constant;

/**
* @author Dharmesh Khandelwal
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public class VIDHealthConstants {
*/
public static final String OUTCOME = "outcome";

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public VidPoolCheckerVerticle(final ApplicationContext context) {
this.context = context;
this.vidService = this.context.getBean(VidService.class);
this.environment = this.context.getBean(Environment.class);
this.threshold = environment.getProperty("mosip.kernel.vid.min-unused-threshold", Long.class);
this.threshold = environment.getProperty("mosip.kernel.vid.min-unused-threshold", Long.class, 100000L);
}

private AtomicBoolean locked = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class VidPopulatorVerticle extends AbstractVerticle {
@SuppressWarnings("unchecked")
public VidPopulatorVerticle(final ApplicationContext context) {
this.environment = context.getBean(Environment.class);
this.vidToGenerate = environment.getProperty("mosip.kernel.vid.vids-to-generate", Long.class);
this.vidToGenerate = environment.getProperty("mosip.kernel.vid.vids-to-generate", Long.class, 200000L);
this.vidWriter = context.getBean("vidWriter", VidWriter.class);
this.metaDataUtil = context.getBean(VIDMetaDataUtil.class);
this.vidGenerator = context.getBean(VidGenerator.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.HashMap;
import java.util.Map;

import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.mockito.Mockito;
Expand Down Expand Up @@ -33,8 +32,8 @@

import io.mosip.kernel.core.authmanager.authadapter.spi.VertxAuthenticationProvider;
import io.mosip.kernel.core.signatureutil.spi.SignatureUtil;
import io.mosip.kernel.vidgenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.vidgenerator.service.VidService;
import io.mosip.kernel.idgenerator.constant.HibernatePersistenceConstant;
import jakarta.persistence.EntityManagerFactory;

/**
* Configuration class for IDGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.zaxxer.hikari.HikariDataSource;

import io.mosip.kernel.core.authmanager.authadapter.spi.VertxAuthenticationProvider;
import io.mosip.kernel.vidgenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.idgenerator.constant.HibernatePersistenceConstant;

/**
* Configuration class for IDGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.HashMap;
import java.util.Map;

import jakarta.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.mockito.Mockito;
Expand Down Expand Up @@ -32,12 +31,8 @@
import com.zaxxer.hikari.HikariDataSource;

import io.mosip.kernel.core.authmanager.authadapter.spi.VertxAuthenticationProvider;
import io.mosip.kernel.core.signatureutil.spi.SignatureUtil;
import io.mosip.kernel.uingenerator.service.UinService;
import io.mosip.kernel.uingenerator.service.impl.UinServiceImpl;
import io.mosip.kernel.vidgenerator.constant.HibernatePersistenceConstant;
import io.mosip.kernel.vidgenerator.service.VidService;
import io.mosip.kernel.vidgenerator.service.impl.VidServiceImpl;
import io.mosip.kernel.idgenerator.constant.HibernatePersistenceConstant;
import jakarta.persistence.EntityManagerFactory;

/**
* Configuration class for IDGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public ResponseDto sendEmail(String[] mailTo, String[] mailCc, String mailSubjec
}

@Async
private void send(String[] mailTo, String[] mailCc, String mailSubject, String mailContent,
public void send(String[] mailTo, String[] mailCc, String mailSubject, String mailContent,
Copy link
Member

Choose a reason for hiding this comment

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

why did we change this to public ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was mentioned that @async annotated methods must be public. Please check this sonar rule - https://sonarcloud.io/organizations/mosip/rules?open=java%3AS2230&rule_key=java%3AS2230

MultipartFile[] attachments) {
EmailNotificationUtils.validateMailArguments(fromEmailAddress, mailTo, mailSubject, mailContent);
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public PridPoolCheckerVerticle(final ApplicationContext context) {
this.context = context;
this.PridService = this.context.getBean(PridService.class);
this.environment = this.context.getBean(Environment.class);
this.threshold = environment.getProperty("mosip.kernel.prid.min-unused-threshold", Long.class);
this.threshold = environment.getProperty("mosip.kernel.prid.min-unused-threshold", Long.class, 1000L);
}

private AtomicBoolean locked = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PridPopulatorVerticle extends AbstractVerticle {
@SuppressWarnings("unchecked")
public PridPopulatorVerticle(final ApplicationContext context) {
this.environment = context.getBean(Environment.class);
this.pridToGenerate = environment.getProperty("mosip.kernel.prid.prids-to-generate", Long.class);
this.pridToGenerate = environment.getProperty("mosip.kernel.prid.prids-to-generate", Long.class, 2000L);
this.pridWriter = context.getBean("pridWriter", PridWriter.class);
this.metaDataUtil = context.getBean("metaDataUtil", MetaDataUtil.class);
this.pridGenerator = context.getBean(PridGenerator.class);
Expand Down
Loading