Skip to content
Snippets Groups Projects

Resolve "Check input for URI format upon calling a connect method"

16 files
+ 198
157
Compare changes
  • Side-by-side
  • Inline

Files

String scheme,host, path;
String scheme, host, path;
java.net.URI uri;
java.net.URI uri;
try {
try {
uri = new java.net.URI({{connectParameterName}});
uri = new java.net.URI({{connectParameterName}});
@@ -9,3 +9,15 @@ try {
@@ -9,3 +9,15 @@ try {
System.err.println(e.getMessage()); // Maybe re-throw error?
System.err.println(e.getMessage()); // Maybe re-throw error?
return false;
return false;
}
}
 
if (scheme == null || scheme.isBlank()) {
 
System.err.println("Missing or empty scheme in " + uri);
 
return false;
 
}
 
if (host == null || host.isBlank()) {
 
System.err.println("Missing or empty host in " + uri);
 
return false;
 
}
 
if (path == null || path.isBlank()) {
 
System.err.println("Missing or empty path in " + uri);
 
return false;
 
}
Loading