Skip to content
Closed
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target/
/.idea/
.env
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
<artifactId>dotenv-java</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<version>4.0.0-beta.15</version>
<scope>test</scope>
</dependency>
Comment on lines +58 to +63
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Consider using a stable WireMock version.

The project uses WireMock version 4.0.0-beta.15, which is a beta release and may have stability or compatibility issues.


🌐 Web query:

What is the latest stable version of WireMock?

💡 Result:

The latest stable WireMock release is 3.13.1 (released June 13, 2025). [1][2]

Sources:
[1] WireMock blog — "WireMock 3.13.1 Released" (June 13, 2025).
[2] GitHub release — wiremock/wiremock tag 3.13.1.


Use WireMock 3.13.1, the latest stable release.

The project currently uses WireMock 4.0.0-beta.15, a beta release that may have stability or compatibility issues. The latest stable version is 3.13.1, which should be preferred for production dependencies.

🤖 Prompt for AI Agents
In pom.xml around lines 58 to 63, replace the WireMock dependency version
4.0.0-beta.15 with the stable release 3.13.1; keep the groupId, artifactId and
<scope>test</scope> unchanged so tests continue to use WireMock but now
reference the stable 3.13.1 version.

</dependencies>
<build>
<plugins>
Expand All @@ -55,7 +71,7 @@
<configuration>
<mainClass>com.example.HelloFX</mainClass>
<options>
<option>--enable-native-access=javafx.graphics</option>
<option>--enable-native-access=javafx.graphics</option>
</options>
<launcher>javafx</launcher>
<stripDebug>true</stripDebug>
Expand All @@ -65,4 +81,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
65 changes: 57 additions & 8 deletions src/main/java/com/example/HelloController.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,71 @@
package com.example;

import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
import javafx.scene.control.*;
import javafx.scene.control.ListCell;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

/**
* Controller layer: mediates between the view (FXML) and the model.
*/
public class HelloController {

private final HelloModel model = new HelloModel();
private final HelloModel model = new HelloModel(new NtfyConnectionImpl());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Tight coupling makes testing difficult.

The HelloModel is instantiated with a hardcoded NtfyConnectionImpl, which prevents dependency injection and makes unit testing challenging. Consider accepting the model (or connection) as a constructor parameter or through a setter method.

Apply this diff to enable dependency injection:

+    private HelloModel model;
+
+    public HelloController() {
+        this(new HelloModel(new NtfyConnectionImpl()));
+    }
+
+    // Package-private constructor for testing
+    HelloController(HelloModel model) {
+        this.model = model;
+    }

-    private final HelloModel model = new HelloModel(new NtfyConnectionImpl());

Alternatively, use a factory pattern or dependency injection framework.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private final HelloModel model = new HelloModel(new NtfyConnectionImpl());
private HelloModel model;
public HelloController() {
this(new HelloModel(new NtfyConnectionImpl()));
}
// Package-private constructor for testing
HelloController(HelloModel model) {
this.model = model;
}
🤖 Prompt for AI Agents
In src/main/java/com/example/HelloController.java around line 15: the controller
currently instantiates HelloModel with a hardcoded new NtfyConnectionImpl(),
causing tight coupling that prevents DI and unit testing; change the class to
accept a HelloModel (or at minimum a NtfyConnection) via constructor injection
(add a constructor taking HelloModel or NtfyConnection and assign it to the
final field) and remove the direct new expression so tests can pass a mock;
optionally provide a no-arg constructor that delegates to the default
NtfyConnectionImpl for production.


@FXML
private Label messageLabel;

@FXML
private ListView<NtfyMessageDto> messageView;

@FXML
private TextArea messageInput;

// Formatter för tid
private final DateTimeFormatter timeFormatter =
DateTimeFormatter.ofPattern("HH:mm:ss")
.withZone(ZoneId.systemDefault());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use consistent language in code comments.

The code contains Swedish comments (e.g., "Formatter för tid", "Visa hälsning", "Koppla ListView till modellens meddelanden") while the rest of the codebase uses English. Use English consistently throughout for better maintainability and collaboration.

Also applies to: 33-34, 36-37, 39-40, 42-43, 56-57

🤖 Prompt for AI Agents
In src/main/java/com/example/HelloController.java around lines 26-29 (and also
apply to lines 33-34, 36-37, 39-40, 42-43, 56-57), replace the Swedish comments
with English equivalents to match the project convention; update comments like
"Formatter för tid" to "Formatter for time" (or "Time formatter"), "Visa
hälsning" to "Show greeting", "Koppla ListView till modellens meddelanden" to
"Bind ListView to model messages", etc., ensuring concise, consistent English
wording and preserving the same intent for each comment.


@FXML
private void initialize() {
if (messageLabel != null) {
messageLabel.setText(model.getGreeting());
}
// Visa hälsning
messageLabel.setText(model.getGreeting());

// Koppla ListView till modellens meddelanden
messageView.setItems(model.getMessages());

// Bind TextArea till modellens property
messageInput.textProperty().bindBidirectional(model.messageToSendProperty());

// Snyggare visning av meddelanden
messageView.setCellFactory(lv -> new ListCell<>() {
@Override
protected void updateItem(NtfyMessageDto msg, boolean empty) {
super.updateItem(msg, empty);
if (empty || msg == null) {
setText(null);
} else {
setText("[" + timeFormatter.format(Instant.ofEpochMilli(msg.time())) + "] "
+ msg.message());
}
}
});

// Scrolla automatiskt ner till senaste meddelandet
model.getMessages().addListener((javafx.collections.ListChangeListener<NtfyMessageDto>) change -> {
Platform.runLater(() -> {
if (!messageView.getItems().isEmpty()) {
messageView.scrollTo(messageView.getItems().size() - 1);
}
});
});
}

@FXML
private void sendMessage(ActionEvent actionEvent) {
model.sendMessage();
messageInput.clear();
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/example/HelloFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class HelloFX extends Application {
public void start(Stage stage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(HelloFX.class.getResource("hello-view.fxml"));
Parent root = fxmlLoader.load();
Scene scene = new Scene(root, 640, 480);
Scene scene = new Scene(root, 1280, 480);
stage.setTitle("Hello MVC");
stage.setScene(scene);
stage.show();
Expand Down
75 changes: 67 additions & 8 deletions src/main/java/com/example/HelloModel.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,74 @@
package com.example;

/**
* Model layer: encapsulates application data and business logic.
*/
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import java.util.function.Consumer;

public class HelloModel {
/**
* Returns a greeting based on the current Java and JavaFX versions.
*/

private final NtfyConnection connection;
private final ObservableList<NtfyMessageDto> messages = FXCollections.observableArrayList();
private final StringProperty messageToSend = new SimpleStringProperty();

public HelloModel(NtfyConnection connection) {
this.connection = connection;
receiveMessage();
}

public ObservableList<NtfyMessageDto> getMessages() {
return messages;
}

public String getMessageToSend() {
return messageToSend.get();
}

public StringProperty messageToSendProperty() {
return messageToSend;
}

public void setMessageToSend(String message) {
messageToSend.set(message);
}

public String getGreeting() {
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
return "Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".";
return "Welcome to ChatApp, made in JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".";
}

public void sendMessage() {
String msg = messageToSend.get();
if (msg == null || msg.isBlank()) {
return;
}
connection.send(msg);
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

public void sendMessageAsync(Consumer<Boolean> callback) {
String msg = messageToSend.get();
if (msg == null || msg.isBlank()) {
callback.accept(false);
return;
}

try {
boolean success = connection.send(msg);
callback.accept(success);
} catch (Exception e) {
callback.accept(false);
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

private void receiveMessage() {
connection.receive(message -> {
if (message == null || message.message() == null || message.message().isBlank()) {
return;
}
Platform.runLater(() -> messages.add(message));
});
}
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/example/ManyParameters.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.example;

public class ManyParameters {

public ManyParameters(String computerName, int timeout,
String method, int size, byte[] data) {

}
Comment on lines +5 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Empty constructor body - incomplete implementation.

The constructor accepts five parameters but doesn't store or use them. Since the class declares no fields, constructed instances will have no state. This makes the builder pattern ineffective, as ManyParametersBuilder.createManyParameters() produces empty objects.

Add fields and assignments:

 public class ManyParameters {
+    private final String computerName;
+    private final int timeout;
+    private final String method;
+    private final int size;
+    private final byte[] data;

     public ManyParameters(String computerName, int timeout,
                           String method, int size, byte[] data) {
-
+        this.computerName = computerName;
+        this.timeout = timeout;
+        this.method = method;
+        this.size = size;
+        this.data = data;
     }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/com/example/ManyParameters.java around lines 5 to 8, the
constructor accepts parameters but has an empty body and the class declares no
fields; add private final fields for computerName (String), timeout (int),
method (String), size (int) and data (byte[]) to the class and assign each
constructor parameter to the corresponding field inside the constructor; also
add simple getters for each field (or make fields non-final with setters if
mutability is required) and update the builder
(ManyParametersBuilder.createManyParameters()) to populate these new fields when
constructing instances.



static void main() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Non-standard main() signature.

This method cannot serve as a Java application entry point because it's package-private and lacks the String[] args parameter. If it's intended as an entry point, use the standard signature. If it's just a demo method, consider renaming it to avoid confusion.

Apply this diff to fix the signature for a proper entry point:

-    static void main() {
+    public static void main(String[] args) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static void main() {
public static void main(String[] args) {
🤖 Prompt for AI Agents
In src/main/java/com/example/ManyParameters.java around line 11, the main method
is package-private and missing the args parameter so it cannot be used as a Java
entry point; change the signature to the standard public static void
main(String[] args) so the JVM can locate and invoke it (if this method was
intended only as a demo, alternatively rename it instead of making it public).

ManyParametersBuilder builder = new ManyParametersBuilder();
builder
.setComputerName("localhost") //Fluent API
.setTimeout(10)
.setSize(0)
.createManyParameters();
Comment on lines +12 to +17
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Unused object creation.

The ManyParameters instance created by the builder is immediately discarded. Either assign it to a variable for further use or remove this demonstration code if it serves no purpose.

Apply this diff to capture the result:

-        ManyParametersBuilder builder = new ManyParametersBuilder();
-        builder
+        ManyParameters params = new ManyParametersBuilder()
                 .setComputerName("localhost")   //Fluent API
                 .setTimeout(10)
                 .setSize(0)
                 .createManyParameters();
+        // Use params...
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ManyParametersBuilder builder = new ManyParametersBuilder();
builder
.setComputerName("localhost") //Fluent API
.setTimeout(10)
.setSize(0)
.createManyParameters();
ManyParameters params = new ManyParametersBuilder()
.setComputerName("localhost") //Fluent API
.setTimeout(10)
.setSize(0)
.createManyParameters();
// Use params...
🤖 Prompt for AI Agents
In src/main/java/com/example/ManyParameters.java around lines 12 to 17, the
builder call creates a ManyParameters instance that is immediately discarded;
either assign the returned object to a variable for later use (e.g.,
ManyParameters params = builder...createManyParameters();) or remove the
builder/demo code if it has no purpose; update subsequent code to use the
assigned variable where appropriate or delete the unused lines to avoid dead
code.

}
}
38 changes: 38 additions & 0 deletions src/main/java/com/example/ManyParametersBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.example;

public class ManyParametersBuilder {
private String computerName;
private int timeout = 0;
private String method;
private int size = 0;
private byte[] data = null;
Comment on lines +4 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent null initialization.

Only data is explicitly initialized to null, while computerName and method are implicitly null. For consistency and clarity, either explicitly initialize all reference types or rely on implicit initialization for all.

Apply this diff for consistency:

     private String computerName;
     private int timeout = 0;
     private String method;
     private int size = 0;
-    private byte[] data = null;
+    private byte[] data;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private String computerName;
private int timeout = 0;
private String method;
private int size = 0;
private byte[] data = null;
private String computerName;
private int timeout = 0;
private String method;
private int size = 0;
private byte[] data;
🤖 Prompt for AI Agents
In src/main/java/com/example/ManyParametersBuilder.java around lines 4 to 8, the
field initializations are inconsistent: data is explicitly set to null while
computerName and method are left implicit; make them consistent by explicitly
initializing reference fields to null (e.g., change the declarations for
computerName and method to "private String computerName = null;" and "private
String method = null;") so all reference types use the same explicit null
initialization.


public ManyParametersBuilder setComputerName(String computerName) {
this.computerName = computerName;
return this;
}

public ManyParametersBuilder setTimeout(int timeout) {
this.timeout = timeout;
return this;
}

public ManyParametersBuilder setMethod(String method) {
this.method = method;
return this;
}

public ManyParametersBuilder setSize(int size) {
this.size = size;
return this;
}

public ManyParametersBuilder setData(byte[] data) {
this.data = data;
return this;
}

public ManyParameters createManyParameters() {
return new ManyParameters(computerName, timeout, method, size, data);
}
}
11 changes: 11 additions & 0 deletions src/main/java/com/example/NtfyConnection.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example;

import java.util.function.Consumer;

public interface NtfyConnection {

public boolean send(String message);

public void receive(Consumer<NtfyMessageDto> messageHandler);

}
62 changes: 62 additions & 0 deletions src/main/java/com/example/NtfyConnectionImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.example;

import io.github.cdimascio.dotenv.Dotenv;
import tools.jackson.databind.ObjectMapper;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix ObjectMapper import package

tools.jackson.databind.ObjectMapper does not exist, so this file will not compile. Please correct the import to the standard Jackson package.

-import tools.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import tools.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
🤖 Prompt for AI Agents
In src/main/java/com/example/NtfyConnectionImpl.java around line 4, the import
uses a non-existent package "tools.jackson.databind.ObjectMapper"; replace it
with the correct Jackson import "com.fasterxml.jackson.databind.ObjectMapper"
(and remove any leftover incorrect imports), then re-run compilation to verify
the class resolves correctly.


import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Objects;
import java.util.function.Consumer;

public class NtfyConnectionImpl implements NtfyConnection {

private final HttpClient http = HttpClient.newHttpClient();
private final String hostName;
private final ObjectMapper mapper = new ObjectMapper();

public NtfyConnectionImpl() {
Dotenv dotenv = Dotenv.load();
hostName = Objects.requireNonNull(dotenv.get("HOST_NAME"));
}

public NtfyConnectionImpl(String hostName) {
this.hostName = hostName;
}

@Override
public boolean send(String message) {
HttpRequest httpRequest = HttpRequest.newBuilder()
.POST(HttpRequest.BodyPublishers.ofString(message))
.header("Cache", "no")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify HTTP header name.

The header "Cache" with value "no" may not be a standard HTTP header. Did you intend to use "Cache-Control" with value "no-cache" or "no-store"?


🌐 Web query:

What is the correct HTTP header to disable caching: Cache or Cache-Control?

💡 Result:

Use Cache-Control. The standard header for controlling/ disabling caching is Cache-Control (HTTP/1.1). To prevent caching use directives such as:

  • Cache-Control: no-store (no storage)
  • Cache-Control: no-cache (forces revalidation / not reused without validation)

For HTTP/1.0 backwards-compatibility also include:

  • Pragma: no-cache
  • Expires: 0

Sources: RFC 7234 (HTTP caching), MDN, OWASP. [1][2][3]

References
[1] RFC 7234 — HTTP/1.1: Caching (Cache-Control, Pragma).
[2] MDN Web Docs — Cache-Control (usage and no-store / no-cache).
[3] OWASP Secure Headers — Cache-Control is recommended; Expires/Pragma for legacy.


:::


🏁 Script executed:

#!/bin/bash
# Verify the file and examine the code context
if [ -f "src/main/java/com/example/NtfyConnectionImpl.java" ]; then
  echo "=== File found. Context around line 33 ==="
  sed -n '25,40p' "src/main/java/com/example/NtfyConnectionImpl.java"
else
  echo "File not found at expected path. Searching for NtfyConnectionImpl.java..."
  find . -name "NtfyConnectionImpl.java" -type f 2>/dev/null | head -5
fi

Length of output: 697


Replace non-standard "Cache" header with standard "Cache-Control".

The header "Cache" is not a standard HTTP header and will be ignored. Change line 33 to .header("Cache-Control", "no-store") or .header("Cache-Control", "no-cache") depending on your caching requirements. For HTTP/1.0 compatibility, also add Pragma: no-cache.

🤖 Prompt for AI Agents
In src/main/java/com/example/NtfyConnectionImpl.java around line 33, the code
sets a non-standard header `.header("Cache", "no")`; replace it with a standard
Cache-Control header such as `.header("Cache-Control", "no-store")` (or
`"no-cache"` if you need validation) and also add a `Pragma: no-cache` header
for HTTP/1.0 compatibility so caching is correctly prevented across clients.

.uri(URI.create(hostName + "/mytopic"))
.build();
try {
//Todo: handle long blocking send requests to not freeze the JavaFX thread
//1. Use thread send message?
//2. Use async?
var reponse = http.send(httpRequest, HttpResponse.BodyHandlers.discarding());
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
return true;
} catch (IOException e) {
System.out.println("Error sending message");
} catch (InterruptedException e) {
System.out.println("Interruped sending message");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix typo in error message.

Line 45 has a typo: Interruped should be Interrupted.

Apply this diff:

-            System.out.println("Interruped sending message");
+            System.out.println("Interrupted sending message");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
System.out.println("Interruped sending message");
System.out.println("Interrupted sending message");
🤖 Prompt for AI Agents
In src/main/java/com/example/NtfyConnectionImpl.java around line 45, the error
message printed contains a typo ("Interruped"); update the string to the correct
spelling ("Interrupted sending message") so the log/readout is correct. Ensure
only the message text is changed and no other logic is altered.

}
return false;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

@Override
public void receive(Consumer<NtfyMessageDto> messageHandler) {
HttpRequest httpRequest = HttpRequest.newBuilder()
.GET()
.uri(URI.create(hostName + "/mytopic/json"))
.build();

http.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofLines())
.thenAccept(response -> response.body()
.map(s -> mapper.readValue(s, NtfyMessageDto.class))
.forEach(messageHandler));
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/example/NtfyMessageDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public record NtfyMessageDto(String id, long time, String event, String topic, String message) {
}
14 changes: 14 additions & 0 deletions src/main/java/com/example/Singelton.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example;

public class Singelton {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the typo in the class name.

The class name is misspelled as "Singelton" instead of "Singleton".

Apply this diff to correct the spelling:

-public class Singelton {
+public class Singleton {
 
-    private final static Singelton instance = new Singelton();
+    private final static Singleton instance = new Singleton();
 
-    private Singelton(){
+    private Singleton(){
 
     }
 
-    public static Singelton getInstance(){
+    public static Singleton getInstance(){
         return instance;
     }
 }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/main/java/com/example/Singelton.java around line 3, the class name is
misspelled as "Singelton"; rename the class to "Singleton" and update the
filename to match (Singleton.java), then update any references/usages/imports
across the codebase to use the corrected class name to prevent compilation
errors.


private final static Singelton instance = new Singelton();

private Singelton(){

}

public static Singelton getInstance(){
return instance;
}
}
Comment on lines +3 to +14
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify the purpose of this singleton class.

This singleton class is not used in any of the provided files and its purpose in the messaging feature is unclear. If it's not needed, consider removing it to avoid dead code.

Run the following script to check for usages of this class:


🏁 Script executed:

#!/bin/bash
# Search for usages of Singelton class
rg -nP '\bSingelton\b' --type=java -C3

Length of output: 827


Remove unused singleton class and fix spelling error.

The verification confirms this class is dead code—no usages exist outside its own definition file. Additionally, the class name has a spelling error ("Singelton" instead of "Singleton"). Either remove the class or correct the spelling and add it to the messaging feature if it's needed.

🤖 Prompt for AI Agents
In src/main/java/com/example/Singelton.java around lines 3 to 14: this class is
dead code and misnamed ("Singelton" vs "Singleton"); either delete the file if
the singleton is not used, or rename the class and file to "Singleton" and
update constructor and getInstance() signatures accordingly, then register or
reference the fixed Singleton from the messaging feature (add usages) so it is
not unused; ensure class visibility and package declarations remain correct and
run a project-wide search/compile to update any imports or references.

3 changes: 3 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
module hellofx {
requires javafx.controls;
requires javafx.fxml;
requires tools.jackson.databind;
requires io.github.cdimascio.dotenv.java;
requires java.net.http;

opens com.example to javafx.fxml;
exports com.example;
Expand Down
Loading
Loading