Lines 391-407
Link Here
|
391 |
} |
391 |
} |
392 |
|
392 |
|
393 |
/** |
393 |
/** |
394 |
* Tries to load the original file from a shadow. |
394 |
* Tries to locate the original file from a shadow. |
395 |
* Looks for file contents as well as the originalFile/originalFileSystem attributes. |
395 |
* Looks for file contents as well as the originalFile/originalFileSystem attributes. |
396 |
* Attempts to discover locations for migrated files in configuration. |
396 |
* Attempts to discover locations for migrated files in configuration. Returns |
|
|
397 |
* {@code null}, if the target file could not be found (broken link) |
397 |
* |
398 |
* |
398 |
* @param fileObject a data shadow |
399 |
* @param fileObject a data shadow |
399 |
* @return the original <code>DataObject</code> referenced by the shadow |
400 |
* @return the original <code>FileObject</code> referenced by the shadow |
400 |
* @throws IOException error during load or broken link |
401 |
* @throws IOException error during load |
401 |
* |
402 |
* |
402 |
* @see Utilities#translate |
403 |
* @see Utilities#translate |
|
|
404 |
* @since 7.42 |
403 |
*/ |
405 |
*/ |
404 |
protected static DataObject deserialize(FileObject fileObject) throws IOException { |
406 |
public static FileObject findOriginal(FileObject fileObject) throws IOException { |
405 |
String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject); |
407 |
String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject); |
406 |
String path = fileAndFileSystem[0]; |
408 |
String path = fileAndFileSystem[0]; |
407 |
assert path != null; |
409 |
assert path != null; |
Lines 465-476
Link Here
|
465 |
} |
467 |
} |
466 |
} |
468 |
} |
467 |
} |
469 |
} |
|
|
470 |
return target; |
471 |
} |
472 |
|
473 |
/** |
474 |
* Tries to load the original file from a shadow. |
475 |
* Looks for file contents as well as the originalFile/originalFileSystem attributes. |
476 |
* Attempts to discover locations for migrated files in configuration. |
477 |
* |
478 |
* @param fileObject a data shadow |
479 |
* @return the original <code>DataObject</code> referenced by the shadow |
480 |
* @throws IOException error during load or broken link |
481 |
* |
482 |
* @see Utilities#translate |
483 |
*/ |
484 |
protected static DataObject deserialize(FileObject fileObject) throws IOException { |
485 |
FileObject target = findOriginal(fileObject); |
468 |
if (target != null) { |
486 |
if (target != null) { |
469 |
return DataObject.find(target); |
487 |
return DataObject.find(target); |
470 |
} else { |
488 |
} else { |
471 |
throw new FileNotFoundException(path + ':' + fsname); |
489 |
String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject); |
|
|
490 |
String path = fileAndFileSystem[0]; |
491 |
throw new FileNotFoundException(path + ':' + fileAndFileSystem[1]); |
472 |
} |
492 |
} |
473 |
} |
493 |
} |
|
|
494 |
|
474 |
static URL readURL(FileObject fileObject) throws IOException { |
495 |
static URL readURL(FileObject fileObject) throws IOException { |
475 |
String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject); |
496 |
String[] fileAndFileSystem = readOriginalFileAndFileSystem(fileObject); |
476 |
String path = fileAndFileSystem[0]; |
497 |
String path = fileAndFileSystem[0]; |