-
Notifications
You must be signed in to change notification settings - Fork 66
Chattplication #37
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
Chattplication #37
Changes from all commits
6e5760c
6627f45
081b820
9e69734
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| target/ | ||
| /.idea/ | ||
| .env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,147 @@ | ||
| package com.example; | ||
|
|
||
| import javafx.application.Platform; | ||
| import javafx.collections.ListChangeListener; | ||
| import javafx.event.ActionEvent; | ||
| import javafx.fxml.FXML; | ||
| import javafx.scene.control.Label; | ||
| import javafx.scene.Node; | ||
| import javafx.scene.control.*; | ||
| import javafx.scene.input.DragEvent; | ||
| import javafx.scene.input.Dragboard; | ||
| import javafx.scene.input.TransferMode; | ||
| import javafx.scene.layout.HBox; | ||
| import javafx.stage.FileChooser; | ||
|
|
||
| import javax.swing.event.HyperlinkListener; | ||
| import javax.tools.Tool; | ||
| import java.awt.Desktop; | ||
| import java.io.File; | ||
| import java.io.FileNotFoundException; | ||
| import java.net.URI; | ||
| import java.nio.file.Path; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * 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()); | ||
|
|
||
| private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm"); | ||
|
|
||
| @FXML private ListView<NtfyMessageDto> messageView; | ||
| @FXML private TextArea messageInput; | ||
|
|
||
| @FXML private void initialize() { | ||
| messageView.setItems(model.getMessages()); | ||
| messageView.setCellFactory(lv -> new ListCell<>() { | ||
| @Override | ||
| protected void updateItem(NtfyMessageDto item, boolean empty) { | ||
| super.updateItem(item, empty); | ||
| if (empty || item == null) { | ||
| setText(null); | ||
| setGraphic(null); | ||
| return; | ||
| } | ||
| String text = item.message(); | ||
| var att = item.attachment(); | ||
|
|
||
| if (att != null && att.url() != null && !att.url().isBlank()) { | ||
| Label msg = new Label(text != null ? text + " ": ""); | ||
| msg.setWrapText(true); | ||
|
|
||
| String linkText = att.name() != null && !att.name().isBlank() | ||
| ? att.name() | ||
| : "Attachment"; | ||
| Hyperlink link = new Hyperlink(linkText); | ||
| if (att.size() > 0) { | ||
| link.setTooltip(new Tooltip(humanSize(att.size()) + (att.type() != null ? " - " + att.type() : ""))); | ||
| } | ||
|
Comment on lines
+38
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainFix potential NPE when attachment size is null
if (att.size() > 0) {
link.setTooltip(new Tooltip(humanSize(att.size()) + (att.type() != null ? " - " + att.type() : "")));
}If Consider guarding the access: - if (att.size() > 0) {
- link.setTooltip(new Tooltip(humanSize(att.size()) + (att.type() != null ? " - " + att.type() : "")));
- }
+ if (att.size() != null && att.size() > 0) {
+ link.setTooltip(new Tooltip(
+ humanSize(att.size()) +
+ (att.type() != null ? " - " + att.type() : "")
+ ));
+ }This keeps the tooltip for known sizes but safely handles missing Length of output: 45 🏁 Script executed: #!/bin/bash
# Search for Attachment.java file directly
fd -t f "Attachment.java"Length of output: 0 🏁 Script executed: #!/bin/bash
# Find NtfyMessageDto class and understand attachment() return type
fd -t f -e java | xargs rg -nP "NtfyMessageDto|record NtfyMessageDto|class NtfyMessageDto" -A10Length of output: 9331 🏁 Script executed: #!/bin/bash
# Search for humanSize method definition
fd -t f -e java | xargs rg -nP "humanSize\s*\(" -B2 -A5Length of output: 1496 🏁 Script executed: #!/bin/bash
# Check HelloController.java lines around 38-58 for full context
fd -t f "HelloController.java" | xargs catLength of output: 5091 Length of output: 509 Fix potential NPE when attachment size is null
if (att.size() > 0) {
link.setTooltip(new Tooltip(humanSize(att.size()) + (att.type() != null ? " - " + att.type() : "")));
}When Apply the guard: - if (att.size() > 0) {
- link.setTooltip(new Tooltip(humanSize(att.size()) + (att.type() != null ? " - " + att.type() : "")));
- }
+ if (att.size() != null && att.size() > 0) {
+ link.setTooltip(new Tooltip(
+ humanSize(att.size()) +
+ (att.type() != null ? " - " + att.type() : "")
+ ));
+ }🤖 Prompt for AI Agents |
||
| link.setOnAction(e -> openInBrowser(att.url())); | ||
|
|
||
| @FXML | ||
| private Label messageLabel; | ||
| HBox row = new HBox(8.0, (Node) msg, (Node) link); | ||
| row.setFillHeight(true); | ||
|
|
||
| setText(null); | ||
| setGraphic(row); | ||
| } else { | ||
| setText(text != null ? text : ""); | ||
| setGraphic(null); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| model.getMessages().addListener((ListChangeListener<NtfyMessageDto>) | ||
| c -> Platform.runLater(() -> { | ||
| if (!messageView.getItems(). isEmpty()) { | ||
| messageView.scrollTo(messageView.getItems().size() - 1); | ||
| } | ||
| }) | ||
| ); | ||
| messageView.setOnDragOver(this::handleDragOver); | ||
| messageView.setOnDragDropped(this::handleDragDropped); | ||
| model.loadInitialMessagesAsync(); | ||
| } | ||
|
|
||
| @FXML public void sendFile(ActionEvent actionEvent) throws FileNotFoundException { | ||
| FileChooser chooser = new FileChooser(); | ||
| chooser.setTitle("Välj fil att skicka"); | ||
| File file = chooser.showOpenDialog(messageView.getScene().getWindow()); | ||
| if (file != null) { | ||
| Path path = file.toPath(); | ||
| model.sendFile(path); | ||
| } | ||
| } | ||
|
Comment on lines
+85
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainHandle file-sending errors in the UI instead of propagating/crashing Two related places:
Both can surface as unhandled exceptions on the JavaFX application thread if the file disappears or is unreadable between selection and send. Consider:
For example: - @FXML public void sendFile(ActionEvent actionEvent) throws FileNotFoundException {
+ @FXML public void sendFile(ActionEvent actionEvent) {
FileChooser chooser = new FileChooser();
chooser.setTitle("Välj fil att skicka");
File file = chooser.showOpenDialog(messageView.getScene().getWindow());
if (file != null) {
Path path = file.toPath();
- model.sendFile(path);
+ try {
+ model.sendFile(path);
+ } catch (FileNotFoundException e) {
+ // TODO: show an error dialog / status label so the user knows the file was not found
+ }
}
} if (db.hasFiles()) {
List<File> files = db.getFiles();
for (File f : files) {
- try {
- model.sendFile(f.toPath());
- } catch (FileNotFoundException ex) {
- throw new RuntimeException(ex);
- }
+ try {
+ model.sendFile(f.toPath());
+ } catch (FileNotFoundException ex) {
+ // TODO: log and/or notify the user for this file, but don’t crash the UI
+ }
}
success = true;
}This keeps the UX resilient while still surfacing problems to the user. Also applies to: 110-121 🏁 Script executed: #!/bin/bash
# Find HelloController.java and examine the two methods in question
fd -t f "HelloController.java" --exec cat {} \;Length of output: 5091 🏁 Script executed: #!/bin/bash
# Alternative: search for the sendFile method and handleDragDropped in Java files
rg -n "sendFile|handleDragDropped" --type java -A 10 -B 2Length of output: 5801 🏁 Script executed: #!/bin/bash
# Look for FileNotFoundException handling patterns in the codebase
rg -n "FileNotFoundException" --type java -C 3Length of output: 4810 🏁 Script executed: #!/bin/bash
# Find the file at the path specified in the review
fd -t f "src/main/java/com/example/HelloController.java"Length of output: 0 🏁 Script executed: #!/bin/bash
# If file exists, extract lines 85-93 and 110-121
if [ -f "src/main/java/com/example/HelloController.java" ]; then
echo "=== Lines 85-93 (sendFile method) ===";
sed -n '85,93p' "src/main/java/com/example/HelloController.java";
echo "";
echo "=== Lines 110-121 (handleDragDropped method) ===";
sed -n '110,121p' "src/main/java/com/example/HelloController.java";
fiLength of output: 910 🏁 Script executed: #!/bin/bash
# Check entire controller file if found to understand context
fd -t f "HelloController.java" -x wc -l {}Length of output: 52 🏁 Script executed: #!/bin/bash
# Search for all throws declarations in Java files
rg -n "throws FileNotFoundException" --type java -C 2Length of output: 1502 🏁 Script executed: #!/bin/bash
# Search for RuntimeException rethrows in Java files
rg -n "throw new RuntimeException" --type java -B 3 -A 1Length of output: 447 🏁 Script executed: #!/bin/bash
# Look for javafx FileChooser usage
rg -n "FileChooser\|showOpenDialog" --type java -B 2 -A 5Length of output: 0 🏁 Script executed: #!/bin/bash
# Search for model.sendFile calls
rg -n "model\.sendFile" --type java -B 2 -A 2Length of output: 834 🏁 Script executed: #!/bin/bash
# Check for dragDropped handling with model.sendFile
rg -n "dragDropped\|handleDragDropped" --type java -B 3 -A 15Length of output: 0 🏁 Script executed: #!/bin/bash
# Look for Alert usage (as suggested in review for user feedback)
rg -n "Alert\|showError\|showWarning" --type javaLength of output: 0 🏁 Script executed: #!/bin/bash
# Find model class and sendFile method signature
rg -n "sendFile\s*\(" --type java -B 1 -A 3Length of output: 2408 🏁 Script executed: #!/bin/bash
# Search for JavaFX application thread context issues
rg -n "Platform\.runLater\|FXMLLoader\|@FXML" --type java | head -20Length of output: 0 🏁 Script executed: #!/bin/bash
# List all files in the source directory
find src/main/java -type f -name "*.java" 2>/dev/null | head -20Length of output: 300 🏁 Script executed: #!/bin/bash
# Get a count of Java files
find . -type f -name "*.java" 2>/dev/null | wc -lLength of output: 1 🏁 Script executed: #!/bin/bash
# If the main file exists, get its full content
find . -type f -name "HelloController.java" 2>/dev/null -exec echo "File found at: {}" \; -exec cat {} \;Length of output: 5155 🏁 Script executed: #!/bin/bash
# Try to locate the file regardless of case
find . -iname "*hellocontroller*" -type f 2>/dev/nullLength of output: 48 🏁 Script executed: #!/bin/bash
# Search for any Java file with "Hello" in the name
find . -type f -name "*Hello*.java" 2>/dev/nullLength of output: 181 🏁 Script executed: #!/bin/bash
# Check if src directory exists and list structure
[ -d "src" ] && find src -type f -name "*.java" 2>/dev/null | head -20Length of output: 395 🏁 Script executed: #!/bin/bash
# Look for any controller files
find . -type f -name "*Controller.java" 2>/dev/null | head -20Length of output: 48 🏁 Script executed: #!/bin/bash
# Search for FXML annotations and file chooser patterns
rg -n "@FXML|FileChooser|showOpenDialog" --type java -lLength of output: 46 🏁 Script executed: #!/bin/bash
# Get detailed info from any matching Java file
rg -n "@FXML public void sendFile" --type java -A 15Length of output: 1436 🏁 Script executed: #!/bin/bash
# Search for the exact method signature from the review
rg -n "public void sendFile\(ActionEvent" --type java -A 10Length of output: 987 🏁 Script executed: #!/bin/bash
# Try to find any references to the methods mentioned
rg -n "void sendFile|void handleDragDropped" --type java -C 5Length of output: 1940 🏁 Script executed: #!/bin/bash
# Broader search for file operations and exceptions
rg -n "FileNotFoundException|model\.sendFile|drag.*drop" --type java -iLength of output: 1332 🏁 Script executed: #!/bin/bash
# Check Java files for exception handling patterns
rg -n "catch.*FileNotFoundException|throws.*FileNotFoundException" --type java -B 2 -A 3Length of output: 2306 🏁 Script executed: #!/bin/bash
# Final attempt: list all directories to understand structure
ls -laLength of output: 689 🏁 Script executed: #!/bin/bash
# Check if there's a pom.xml or build configuration
find . -maxdepth 3 -name "pom.xml" -o -name "build.gradle" -o -name "*.xml" | head -10Length of output: 9 🏁 Script executed: #!/bin/bash
# Look for example or demo Java applications
find . -type f -name "*.java" 2>/dev/null | xargs grep -l "HelloController\|sendFile\|FileChooser" 2>/dev/nullLength of output: 192 🏁 Script executed: #!/bin/bash
# Get overall repository structure
find . -maxdepth 3 -type d 2>/dev/null | sortLength of output: 313 🏁 Script executed: #!/bin/bash
# Final comprehensive search for Java file patterns mentioned in review
find . -type f \( -name "*.java" -o -name "*.fxml" \) 2>/dev/null | xargs grep -l "sendFile\|handleDragDropped" 2>/dev/null || echo "No matches found"Length of output: 241 🏁 Script executed: #!/bin/bash
# Check README or documentation
find . -maxdepth 2 -name "README*" -o -name "readme*" 2>/dev/null | xargs cat 2>/dev/null | head -30Length of output: 611 Handle file-sending errors in the controller to prevent UI crashes Both file-sending entry points lack proper error handling:
In both cases, a file can legitimately disappear or become unreadable between user selection/drag and the actual send operation. Wrap src/main/java/com/example/HelloController.java, line 85:
src/main/java/com/example/HelloController.java, lines 116–120:
🤖 Prompt for AI Agents |
||
|
|
||
| @FXML | ||
| private void initialize() { | ||
| if (messageLabel != null) { | ||
| messageLabel.setText(model.getGreeting()); | ||
| public void sendMessage(ActionEvent actionEvent) { | ||
| String text = messageInput != null ? messageInput.getText() : ""; | ||
| if (text != null && !text.isBlank() && model.sendMessage(text)) { | ||
| messageInput.clear(); | ||
| } | ||
| } | ||
|
|
||
| private void handleDragOver(DragEvent e) { | ||
| Dragboard db = e.getDragboard(); | ||
| if (db.hasFiles()) { | ||
| e.acceptTransferModes(TransferMode.COPY); | ||
| } | ||
| e.consume(); | ||
| } | ||
|
|
||
| private void handleDragDropped(DragEvent e) { | ||
| Dragboard db = e.getDragboard(); | ||
| boolean success = false; | ||
| if (db.hasFiles()) { | ||
| List<File> files = db.getFiles(); | ||
| for (File f : files) { | ||
| try { | ||
| model.sendFile(f.toPath()); | ||
| } catch (FileNotFoundException ex) { | ||
| throw new RuntimeException(ex); | ||
| } | ||
| } | ||
| success = true; | ||
| } | ||
| e.setDropCompleted(success); | ||
| e.consume(); | ||
| } | ||
|
|
||
| private void openInBrowser(String url) { | ||
| try { | ||
| if (Desktop.isDesktopSupported()) { | ||
| Desktop.getDesktop().browse(URI.create(url)); | ||
| } else { | ||
| // fallback: ingen Desktop, gör inget (kan ersättas med HostServices) | ||
| } | ||
| } catch (Exception ignored) { | ||
| } | ||
| } | ||
|
|
||
| private static String humanSize(long bytes) { | ||
| // kort & enkel | ||
| String[] units = {"B","KB","MB","GB","TB"}; | ||
| double v = bytes; | ||
| int i = 0; | ||
| while (v >= 1024 && i < units.length - 1) { v /= 1024; i++; } | ||
| return String.format("%.1f %s", v, units[i]); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,15 +1,65 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| 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.io.FileNotFoundException; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.nio.file.Path; | ||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.concurrent.CompletableFuture; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public class HelloModel { | ||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||
| * Returns a greeting based on the current Java and JavaFX versions. | ||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||
| public String getGreeting() { | ||||||||||||||||||||||||||||||||||||||||||||||
| String javaVersion = System.getProperty("java.version"); | ||||||||||||||||||||||||||||||||||||||||||||||
| String javafxVersion = System.getProperty("javafx.version"); | ||||||||||||||||||||||||||||||||||||||||||||||
| return "Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| private final NtfyConnection connection; | ||||||||||||||||||||||||||||||||||||||||||||||
| private final ObservableList<NtfyMessageDto> messages = FXCollections.observableArrayList(); | ||||||||||||||||||||||||||||||||||||||||||||||
| //private final StringProperty messageToSend = new SimpleStringProperty(); | ||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Remove commented code. Lines 16, 26-28, and 44-50 contain commented-out code that should be deleted rather than left in the source. If this code is needed for tests (as suggested by Apply this diff if the code is truly unused: private final NtfyConnection connection;
private final ObservableList<NtfyMessageDto> messages = FXCollections.observableArrayList();
- //private final StringProperty messageToSend = new SimpleStringProperty();
public HelloModel(NtfyConnection connection) {And remove the commented sections at lines 26-28 and 44-50 as well. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public HelloModel(NtfyConnection connection) { | ||||||||||||||||||||||||||||||||||||||||||||||
| this.connection = connection; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public ObservableList<NtfyMessageDto> getMessages() { | ||||||||||||||||||||||||||||||||||||||||||||||
| return messages; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /*public String getMessageToSend() { | ||||||||||||||||||||||||||||||||||||||||||||||
| return messageToSend.get(); | ||||||||||||||||||||||||||||||||||||||||||||||
| }*/ | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public void loadInitialMessagesAsync() { | ||||||||||||||||||||||||||||||||||||||||||||||
| CompletableFuture | ||||||||||||||||||||||||||||||||||||||||||||||
| .supplyAsync(connection::fetchHistory) | ||||||||||||||||||||||||||||||||||||||||||||||
| .thenAccept(list -> Platform.runLater(() -> { | ||||||||||||||||||||||||||||||||||||||||||||||
| messages.setAll(list); | ||||||||||||||||||||||||||||||||||||||||||||||
| subscribeLive(); // start streaming after history | ||||||||||||||||||||||||||||||||||||||||||||||
| })) | ||||||||||||||||||||||||||||||||||||||||||||||
| .exceptionally(ex -> null); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+30
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error logging for async failures. The exception handler silently discards errors ( Apply this diff to add basic error handling: public void loadInitialMessagesAsync() {
CompletableFuture
.supplyAsync(connection::fetchHistory)
.thenAccept(list -> Platform.runLater(() -> {
messages.setAll(list);
subscribeLive(); // start streaming after history
}))
- .exceptionally(ex -> null);
+ .exceptionally(ex -> {
+ System.err.println("Failed to load message history: " + ex.getMessage());
+ ex.printStackTrace();
+ return null;
+ });
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| private void subscribeLive() { | ||||||||||||||||||||||||||||||||||||||||||||||
| connection.receive(m -> Platform.runLater(() -> messages.add(m))); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| /*public StringProperty messageToSendProperty() { | ||||||||||||||||||||||||||||||||||||||||||||||
| return messageToSend; | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public void setMessageToSend(String message) { | ||||||||||||||||||||||||||||||||||||||||||||||
| messageToSend.set(message); | ||||||||||||||||||||||||||||||||||||||||||||||
| }*/ | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public boolean sendMessage(String text) { | ||||||||||||||||||||||||||||||||||||||||||||||
| return connection.send(text); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public boolean sendFile(Path path) throws FileNotFoundException { | ||||||||||||||||||||||||||||||||||||||||||||||
| return connection.sendFile(path); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| public void receiveMessage() { | ||||||||||||||||||||||||||||||||||||||||||||||
| connection.receive(m -> Platform.runLater(() -> messages.add(m))); | ||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.example; | ||
|
|
||
| import java.io.FileNotFoundException; | ||
| import java.nio.file.Path; | ||
| import java.util.List; | ||
| import java.util.function.Consumer; | ||
|
|
||
| public interface NtfyConnection { | ||
|
|
||
| boolean send(String message); | ||
|
|
||
| void receive(Consumer<NtfyMessageDto> messageHandler); | ||
|
|
||
| List<NtfyMessageDto> fetchHistory(); | ||
|
|
||
| boolean sendFile(Path path) throws FileNotFoundException; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify WireMock stable release availability.
The dependency uses a beta version (4.0.0-beta.15). Consider using a stable release for better reliability in tests.
🌐 Web query:
💡 Result:
The latest stable WireMock for Java is version 3.13.1 (released June 12, 2025). [1][2]
Note: WireMock 4.x is currently available only as beta releases. [2]
Sources:
Consider upgrading to the latest stable WireMock version.
The latest stable WireMock for Java is version 3.13.1, while the current dependency uses 4.0.0-beta.15. WireMock 4.x is currently available only as beta releases. Update
pom.xmlline 59 to use version 3.13.1 for improved stability in your test suite.🤖 Prompt for AI Agents