I have a program that involves downloading an image from the internet from said image's src, and it works perfectly most of the time, however if the src of the image has a "-" in the address I get an IOException.
BufferedImage image = null;
fileName = emailFirst + "_at_" + emailLast + " (" + fullName + ")";
URL url = new URL(imageUrl);
image = ImageIO.read(url);
System.out.println("DIRECTORY: " + directory);
ImageIO.write(image, "jpg", new java.io.File(directory + "\\" + fileName + ".jpg"));
The only instances where this fails to work is when the url has a hyphen such as this link within "wp-content"
https://www.applicoinc.com/wp-content/uploads/2016/04/Employee_Alex_Moazed.jpg
Any ideas?