Compare commits

..

4 Commits

Author SHA1 Message Date
d4181b5c7a docs: update .all-contributorsrc [skip ci] 2021-01-30 10:46:01 +00:00
aab2d2e302 docs: update README.md [skip ci] 2021-01-30 10:46:00 +00:00
462b581b34 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>
2021-01-27 16:24:06 +02:00
9abfd5777c docs: add rohit10000 as a contributor (#1637)
* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
2021-01-26 22:22:48 +02:00
6 changed files with 24 additions and 19 deletions

View File

@ -1386,6 +1386,15 @@
"contributions": [
"code"
]
},
{
"login": "byoungju94",
"name": "byoungju94",
"avatar_url": "https://avatars.githubusercontent.com/u/42516378?v=4",
"profile": "https://github.com/byoungju94",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 4,

View File

@ -10,7 +10,7 @@
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-152-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-153-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<br/>
@ -303,6 +303,9 @@ This project is licensed under the terms of the MIT license.
<td align="center"><a href="https://github.com/demirhalil"><img src="https://avatars1.githubusercontent.com/u/22895118?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Halil Demir</b></sub></a><br /><a href="#translation-demirhalil" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/rohit10000"><img src="https://avatars.githubusercontent.com/u/20845565?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rohit Singh</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=rohit10000" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://github.com/byoungju94"><img src="https://avatars.githubusercontent.com/u/42516378?v=4?s=100" width="100px;" alt=""/><br /><sub><b>byoungju94</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=byoungju94" title="Code">💻</a></td>
</tr>
</table>
<!-- markdownlint-restore -->

View File

@ -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) {

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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) {