Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Bruno Borges
2026-04-06 14:09:17 -04:00
parent 46f6f3e6db
commit 57b2799408
7 changed files with 50 additions and 37 deletions

View File

@@ -22,7 +22,12 @@ public class AccessibilityReport {
var reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter URL to analyze: ");
String url = reader.readLine().trim();
String urlLine = reader.readLine();
if (urlLine == null) {
System.out.println("No URL provided. Exiting.");
return;
}
String url = urlLine.trim();
if (url.isEmpty()) {
System.out.println("No URL provided. Exiting.");
return;

View File

@@ -24,8 +24,14 @@ public class ErrorHandling {
session.close();
} catch (ExecutionException ex) {
System.err.println("Error: " + ex.getCause().getMessage());
ex.getCause().printStackTrace();
Throwable cause = ex.getCause();
Throwable error = cause != null ? cause : ex;
System.err.println("Error: " + error.getMessage());
error.printStackTrace();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
System.err.println("Interrupted: " + ex.getMessage());
ex.printStackTrace();
} catch (Exception ex) {
System.err.println("Error: " + ex.getMessage());
ex.printStackTrace();

View File

@@ -25,9 +25,9 @@ public class MultipleSessions {
var s1 = f1.get(); var s2 = f2.get(); var s3 = f3.get();
// Send a message to each session
System.out.println("S1: " + s1.sendAndWait(new MessageOptions().setPrompt("Explain Java records")).get().getMessage());
System.out.println("S2: " + s2.sendAndWait(new MessageOptions().setPrompt("Explain sealed classes")).get().getMessage());
System.out.println("S3: " + s3.sendAndWait(new MessageOptions().setPrompt("Explain pattern matching")).get().getMessage());
System.out.println("S1: " + s1.sendAndWait(new MessageOptions().setPrompt("Explain Java records")).get().getData().content());
System.out.println("S2: " + s2.sendAndWait(new MessageOptions().setPrompt("Explain sealed classes")).get().getData().content());
System.out.println("S3: " + s3.sendAndWait(new MessageOptions().setPrompt("Explain pattern matching")).get().getData().content());
// Clean up
s1.destroy().get(); s2.destroy().get(); s3.destroy().get();

View File

@@ -54,10 +54,8 @@ jbang PRVisualization.java github/copilot-sdk
jbang ManagingLocalFiles.java /path/to/your/folder
```
**Ralph Loop in planning mode:**
**Ralph Loop with a prompt file:**
```bash
jbang RalphLoop.java plan 5
```
## Why JBang?