title: Load image from URL and default image on error
body: <p>I am trying to load an image from a URL and this was very easy and works great. However, if the image doesnt exist I want it to default to a local image. The problem I am having is that it doesnt throw any exceptions. Instead it will just not display anything. I'm assuming I have to validate the URL some how, but I want to also be sure that its an image and not a webpage/script...etc</p>
  
  <p>Here is my basic test code. This works:</p>
  
  <pre><code>public class DownloadImage extends Application {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage primaryStage) {
  
          VBox root = new VBox();
  
          String imageSource = "https://www.wbkidsgo.com/Portals/1/Content/Hero/HeroBugsCarrot/Source/Default/WB_LT_HeroImage_Bugs_v1.png";
  
          ImageView imageView = new ImageView(new Image(imageSource));
  
          root.getChildren().add(imageView);
  
          primaryStage.setScene(new Scene(root, 1000, 1000));
          primaryStage.show();
  
      }
  }
  </code></pre>
  
  <p>But if I load a bad URL i.e. (two s's in Portals): </p>
  
  <p><code>String imageSource = "https://www.wbkidsgo.com/Portalss/1/Content/Hero/HeroBugsCarrot/Source/Default/WB_LT_HeroImage_Bugs_v1.png";</code></p>
  
  <p>It will just be blank. I thought about creating an HTTP client and sending a request prior to creating the image, but generating the HTTP client takes a few seconds and I will be loading upwards of 300 or so images. I guess I can have one http client, and make one request for each image and check the response datatype to see if its an image, but is there a better way?  </p>