title: java.lang.IllegalArgumentException: URI with undefined scheme
body: <p>Good day. I've defined a 2 <code>URI</code>'s for a <code>http</code> call. The first one works great, the code is a complete copy beside some arguments. The second one throws a <code>Exception</code> . I'll list the code below.</p>
  <pre><code>public class WeatherAPI {
       
           private static String apiKey = &quot;asdasd&quot;;
           private HttpResponse&lt;String&gt; response;
           private URI uri;
       
           private HttpRequest getRequest(URI newUri) {
               return HttpRequest.newBuilder()
                       .uri(newUri)
                       .build();
           }
       
           private HttpClient getClient() {
               return HttpClient.newBuilder().build();
           }
       
           private String getResponse(URI uri) {
               var client = getClient();
               var request = getRequest(uri);
               try {
                   response = client.send(request, HttpResponse.BodyHandlers.ofString());
               }  catch (IOException | InterruptedException e) {
                   e.printStackTrace();
               }
               return response.body();
           }
           public JSONObject getCityData(String lat, String lon) {
               String url = &quot;api.openweathermap.org/data/2.5/weather&quot;; //        System.out.println(uri);
               try {
                   uri = new URIBuilder(URI.create(url))
                           .addParameter(&quot;lat&quot;, lat)
                           .addParameter(&quot;lon&quot;, lon)
                           .addParameter(&quot;appid&quot;, apiKey)
                           .build();
                   System.out.println(uri);
       
               }  catch (URISyntaxException e) {
                   e.printStackTrace();
               }
               var body = getResponse(uri);
               System.out.println(body);
               return null;
           }
       
       }
  </code></pre>
  <p><strong>Throws</strong></p>
  <blockquote>
  <p>Exception in thread &quot;main&quot; java.lang.IllegalArgumentException: URI
  with undefined scheme</p>
  </blockquote>