Lines 393-413
Link Here
|
393 |
* If you are running with the MasterFS module enabled, that will guarantee |
393 |
* If you are running with the MasterFS module enabled, that will guarantee |
394 |
* that this method never returns null for a file which exists on disk. |
394 |
* that this method never returns null for a file which exists on disk. |
395 |
* </p> |
395 |
* </p> |
396 |
* @param file a disk file (may or may not exist) |
396 |
* @param file a disk file (may or may not exist). This file |
|
|
397 |
* must be normalized {@link #normalizeFile normalized}. |
397 |
* @return a corresponding file object, or null if the file does not exist |
398 |
* @return a corresponding file object, or null if the file does not exist |
398 |
* or there is no {@link URLMapper} available to convert it |
399 |
* or there is no {@link URLMapper} available to convert it |
399 |
* @throws IllegalArgumentException if the file is not {@link #normalizeFile normalized} |
|
|
400 |
* @since 4.29 |
400 |
* @since 4.29 |
401 |
*/ |
401 |
*/ |
402 |
public static FileObject toFileObject(File file) throws IllegalArgumentException { |
402 |
public static FileObject toFileObject(File file) throws IllegalArgumentException { |
|
|
403 |
assert file.equals(normalizeFile(file)) : file.getAbsolutePath(); |
403 |
FileObject retVal = null; |
404 |
FileObject retVal = null; |
404 |
|
|
|
405 |
if (!file.equals(normalizeFile(file))) { |
406 |
throw new IllegalArgumentException( |
407 |
"Parameter file was not " + // NOI18N |
408 |
"normalized. Was " + file + " instead of " + normalizeFile(file) |
409 |
); // NOI18N |
410 |
} |
411 |
|
405 |
|
412 |
try { |
406 |
try { |
413 |
URL url = fileToURL(file); |
407 |
URL url = fileToURL(file); |