clearing Sonar Blockers (#1633)
* update gitignore .checkstyle files are being tracked which should not be * NOSONAR for statement excluded from SONAR analysis as it is already dealt using functional approach https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&issues=AW8FwRBhm8eoEVQR-x0f&open=AW8FwRBhm8eoEVQR-x0f * achieved thread safety with lazy initialization https://sonarcloud.io/project/issues?fileUuids=AXb6t0PKusn4P8Tm-LmM&id=iluwatar_java-design-patterns&open=AXb6t19yusn4P8Tm-Lmo&resolved=false * remove double checked locking and initialize before using https://sonarcloud.io/project/issues?fileUuids=AXb6t0PKusn4P8Tm-LmK&id=iluwatar_java-design-patterns&open=AXb6t19qusn4P8Tm-Lmk&resolved=false * NOSONAR for the line https://sonarcloud.io/project/issues?id=iluwatar_java-design-patterns&issues=AXPd3iSe46HRSze7cz3D&open=AXPd3iSe46HRSze7cz3D Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
parent
9abfd5777c
commit
462b581b34
@ -67,7 +67,7 @@ public class DbCustomerDao implements CustomerDao {
|
||||
public Stream<Customer> getAll() throws Exception {
|
||||
try {
|
||||
var connection = getConnection();
|
||||
var statement = connection.prepareStatement("SELECT * FROM CUSTOMERS");
|
||||
var statement = connection.prepareStatement("SELECT * FROM CUSTOMERS"); // NOSONAR
|
||||
var resultSet = statement.executeQuery(); // NOSONAR
|
||||
return StreamSupport.stream(new Spliterators.AbstractSpliterator<Customer>(Long.MAX_VALUE,
|
||||
Spliterator.ORDERED) {
|
||||
|
@ -38,16 +38,13 @@ public class Db {
|
||||
*
|
||||
* @return singleton instance of Db class
|
||||
*/
|
||||
public static Db getInstance() {
|
||||
public static synchronized Db getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (Db.class) {
|
||||
if (instance == null) {
|
||||
instance = new Db();
|
||||
instance.userName2User = new HashMap<>();
|
||||
instance.user2Account = new HashMap<>();
|
||||
instance.itemName2Product = new HashMap<>();
|
||||
}
|
||||
}
|
||||
Db newInstance = new Db();
|
||||
newInstance.userName2User = new HashMap<>();
|
||||
newInstance.user2Account = new HashMap<>();
|
||||
newInstance.itemName2Product = new HashMap<>();
|
||||
instance = newInstance;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
@ -38,13 +38,9 @@ public class MaintenanceLock {
|
||||
*
|
||||
* @return singleton instance of MaintenanceLock
|
||||
*/
|
||||
public static MaintenanceLock getInstance() {
|
||||
public static synchronized MaintenanceLock getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (MaintenanceLock.class) {
|
||||
if (instance == null) {
|
||||
instance = new MaintenanceLock();
|
||||
}
|
||||
}
|
||||
instance = new MaintenanceLock();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
@ -55,6 +51,6 @@ public class MaintenanceLock {
|
||||
|
||||
public void setLock(boolean lock) {
|
||||
this.lock = lock;
|
||||
LOGGER.info("Maintenance lock is set to: " + lock);
|
||||
LOGGER.info("Maintenance lock is set to: ", lock);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class HotelDaoImpl implements HotelDao {
|
||||
public Stream<Room> getAll() throws Exception {
|
||||
try {
|
||||
var connection = getConnection();
|
||||
var statement = connection.prepareStatement("SELECT * FROM ROOMS");
|
||||
var statement = connection.prepareStatement("SELECT * FROM ROOMS"); // NOSONAR
|
||||
var resultSet = statement.executeQuery(); // NOSONAR
|
||||
return StreamSupport.stream(new Spliterators.AbstractSpliterator<Room>(Long.MAX_VALUE,
|
||||
Spliterator.ORDERED) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user