- 
    Bug 
- 
    Resolution: Unresolved
- 
     P4 P4
- 
    jfx17.0.7, jfx21, jfx22
- 
        x86_64
- 
        windows
                    ADDITIONAL SYSTEM INFORMATION :
Windows and Java 11+
A DESCRIPTION OF THE PROBLEM :
With JavaFX 21 and newer, the Image constructor throws an IllegalArgumentException for file paths on windows that can be resolved by java.io.File, i.e. a path starting with a drive letter like `C:\` was accepted but is not anymore.
Starting with the jfx21 branch, the lines [1130-1132](https://github.com/openjdk/jfx/blob/jfx20/modules/javafx.graphics/src/main/java/javafx/scene/image/Image.java#L1130-L1132) that accepted existing files are missing.
REGRESSION : Last worked in version 20
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Calling the Image constructor with a valid and existing path to an image file should work as in previous versions:
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
new Image(pathToAnExistingAndValidImageFile);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The image should be created without throwing an exception.
ACTUAL -
java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
---------- BEGIN SOURCE ----------
private Image getTestImage() throws FileNotFoundException {
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
File existingImageFile = new File(pathToAnExistingAndValidImageFile);
if (existingImageFile.exists()) {
return new Image(pathToAnExistingAndValidImageFile);
} else {
throw new FileNotFoundException(pathToAnExistingAndValidImageFile);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
We need to get a now valid url description with either `URI#toString(): String` or `URL#toExternalForm(): String`.
The example code above would work like this:
```
private Image getTestImage() {
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
File existingImageFile = new File(pathToAnExistingAndValidImageFile);
return new Image(existingImageFile.toURI().toString());
}
```
FREQUENCY : always
            
Windows and Java 11+
A DESCRIPTION OF THE PROBLEM :
With JavaFX 21 and newer, the Image constructor throws an IllegalArgumentException for file paths on windows that can be resolved by java.io.File, i.e. a path starting with a drive letter like `C:\` was accepted but is not anymore.
Starting with the jfx21 branch, the lines [1130-1132](https://github.com/openjdk/jfx/blob/jfx20/modules/javafx.graphics/src/main/java/javafx/scene/image/Image.java#L1130-L1132) that accepted existing files are missing.
REGRESSION : Last worked in version 20
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Calling the Image constructor with a valid and existing path to an image file should work as in previous versions:
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
new Image(pathToAnExistingAndValidImageFile);
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The image should be created without throwing an exception.
ACTUAL -
java.lang.IllegalArgumentException: Invalid URL: unknown protocol: c
---------- BEGIN SOURCE ----------
private Image getTestImage() throws FileNotFoundException {
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
File existingImageFile = new File(pathToAnExistingAndValidImageFile);
if (existingImageFile.exists()) {
return new Image(pathToAnExistingAndValidImageFile);
} else {
throw new FileNotFoundException(pathToAnExistingAndValidImageFile);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
We need to get a now valid url description with either `URI#toString(): String` or `URL#toExternalForm(): String`.
The example code above would work like this:
```
private Image getTestImage() {
String pathToAnExistingAndValidImageFile = "C:\\Data\\test.png";
File existingImageFile = new File(pathToAnExistingAndValidImageFile);
return new Image(existingImageFile.toURI().toString());
}
```
FREQUENCY : always
- relates to
- 
                    JDK-8300872 WebView's ColorChooser fails to initialize when running in security context -           
- Resolved
 
-         
- 
                    JDK-8267551 Support loading images from inline data-URIs -           
- Resolved
 
-         
