Lines 393-414
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) { |
403 |
FileObject retVal = null; |
403 |
boolean asserts = false; |
404 |
|
404 |
assert asserts = true; |
405 |
if (!file.equals(normalizeFile(file))) { |
405 |
if (asserts && !file.equals(normalizeFile(file))) { |
406 |
throw new IllegalArgumentException( |
406 |
throw new IllegalArgumentException( |
407 |
"Parameter file was not " + // NOI18N |
407 |
"Parameter file was not " + // NOI18N |
408 |
"normalized. Was " + file + " instead of " + normalizeFile(file) |
408 |
"normalized. Was " + file + " instead of " + normalizeFile(file) |
409 |
); // NOI18N |
409 |
); // NOI18N |
410 |
} |
410 |
} |
411 |
|
411 |
|
|
|
412 |
FileObject retVal = null; |
413 |
|
412 |
try { |
414 |
try { |
413 |
URL url = fileToURL(file); |
415 |
URL url = fileToURL(file); |
414 |
|
416 |
|
Lines 428-434
Link Here
|
428 |
|
430 |
|
429 |
return retVal; |
431 |
return retVal; |
430 |
} |
432 |
} |
431 |
|
433 |
|
432 |
static URL fileToURL(File file) throws MalformedURLException { |
434 |
static URL fileToURL(File file) throws MalformedURLException { |
433 |
URL retVal = null; |
435 |
URL retVal = null; |
434 |
|
436 |
|