Skip to content

Commit a3df897

Browse files
committed
More sonar findings
1 parent 97c8d99 commit a3df897

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

server/src/main/java/dev/findfirst/core/service/TypesenseService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class TypesenseService {
3131

3232
private final Client client;
3333

34-
private final String schemaName = "bookmark";
34+
private final static String schemaName = "bookmark";
3535

3636
@PostConstruct
3737
public String createSchema() {

server/src/main/java/dev/findfirst/users/controller/UserController.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ public ResponseEntity<String> uploadProfilePicture(
184184
}
185185

186186
try {
187-
User user = userService.getUserById(uContext.getUserId()).orElseThrow(NoUserFoundException::new);
187+
User user =
188+
userService.getUserById(uContext.getUserId()).orElseThrow(NoUserFoundException::new);
188189
userService.changeUserPhoto(user, file);
189190

190191
return ResponseEntity.ok("File uploaded successfully.");
@@ -202,7 +203,7 @@ public ResponseEntity<Resource> getUserProfilePicture(@RequestParam("userId") in
202203
var opt = userService.getUserById(userId);
203204
if (opt.isEmpty()) {
204205
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
205-
}
206+
}
206207

207208
String userPhotoPath = opt.get().getUserPhoto();
208209

server/src/test/java/dev/findfirst/core/controller/BookmarkControllerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void importBookmarks() throws IOException {
454454
* Tests importing a file with an invalid content type (not text/html).
455455
*/
456456
@Test
457-
void importBookmarksWithInvalidContentType() throws IOException {
457+
void importBookmarksWithInvalidContentType() {
458458
// Create a byte array with text/plain content type
459459
byte[] fileContent = "<html><body>Test Content</body></html>".getBytes(StandardCharsets.UTF_8);
460460

@@ -484,7 +484,7 @@ void importBookmarksWithInvalidContentType() throws IOException {
484484
* Tests importing a file that exceeds the maximum allowed size of 250MB.
485485
*/
486486
@Test
487-
void importBookmarksWithFileTooLarge() throws IOException {
487+
void importBookmarksWithFileTooLarge() {
488488
// Create a byte array slightly larger than 250MB (31,250,001 bytes)
489489
byte[] largeFile = new byte[31_250_001];
490490

@@ -515,7 +515,7 @@ void importBookmarksWithFileTooLarge() throws IOException {
515515
* Tests importing a .html file with an unsupported content type (e.g., application/json).
516516
*/
517517
@Test
518-
void importBookmarksWithUnsupportedContentType() throws IOException {
518+
void importBookmarksWithUnsupportedContentType() {
519519
// Create a byte array with application/json content
520520
byte[] fileContent = "{\"bookmarks\": []}".getBytes(StandardCharsets.UTF_8);
521521

@@ -548,7 +548,7 @@ void importBookmarksWithUnsupportedContentType() throws IOException {
548548
* Tests importing a .html file without specifying a content type.
549549
*/
550550
@Test
551-
void importBookmarksWithMissingContentType() throws IOException {
551+
void importBookmarksWithMissingContentType() {
552552
// Create a byte array with valid HTML content
553553
byte[] fileContent = "<html><body>Test Content</body></html>".getBytes(StandardCharsets.UTF_8);
554554

@@ -580,7 +580,7 @@ void importBookmarksWithMissingContentType() throws IOException {
580580
* Tests importing a .html file with text/plain content type.
581581
*/
582582
@Test
583-
void importBookmarksWithTextPlainContentType() throws IOException {
583+
void importBookmarksWithTextPlainContentType() {
584584
// Create a byte array with text/plain content
585585
byte[] fileContent =
586586
"<html><body>Plain Text Content</body></html>".getBytes(StandardCharsets.UTF_8);

server/src/test/java/dev/findfirst/core/service/TypesenseServiceTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,5 @@ void initializationWasNotFinished() throws Exception {
7777

7878
@Test
7979
@Disabled("Implement test to save storeScrapedText")
80-
void storeScrapedText() throws Exception {
81-
82-
}
80+
void storeScrapedText() throws Exception {}
8381
}

server/src/test/java/dev/findfirst/security/util/KeyGeneratorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ void testGenerateKeysProducesDifferentKeysOnSeparateRuns()
7474
String pubKeyContent1 = Files.readString(publicKeyPath1);
7575
String pubKeyContent2 = Files.readString(publicKeyPath2);
7676

77-
String pubKeyBase64_1 = pubKeyContent1.replace("-----BEGIN PUBLIC KEY-----", "")
77+
String pubKeyBase64One = pubKeyContent1.replace("-----BEGIN PUBLIC KEY-----", "")
7878
.replace("-----END PUBLIC KEY-----", "").replaceAll("\\s", "");
79-
String pubKeyBase64_2 = pubKeyContent2.replace("-----BEGIN PUBLIC KEY-----", "")
79+
String pubKeyBase64Two = pubKeyContent2.replace("-----BEGIN PUBLIC KEY-----", "")
8080
.replace("-----END PUBLIC KEY-----", "").replaceAll("\\s", "");
8181

82-
assertNotEquals(pubKeyBase64_1, pubKeyBase64_2, "Each generated public key should be unique");
82+
assertNotEquals(pubKeyBase64One, pubKeyBase64Two, "Each generated public key should be unique");
8383

8484
}
8585

0 commit comments

Comments
 (0)