in src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java [152:187]
public File createNewDataFile(final InputStream stream,
final String url,
final String digest,
final String hint)
throws IOException {
// check if we already have this data
if ( digest != null ) {
synchronized ( this.digestCache ) {
final CacheEntry storedDigest = this.digestCache.get(url);
if ( storedDigest != null && storedDigest.digest.equals(digest) ) {
log.debug(
"File {} with digest {} found, returning {}",
url, digest, safePath(storedDigest.file));
return storedDigest.file;
}
}
}
final int pos = url.lastIndexOf('/');
final String name = url.substring(pos + 1);
final String filename = (hint == null ? "rsrc" : hint) + '-' + name + '-' + getNextSerialNumber() + ".ser";
//replace special characters from the filename that are not allowed by the OS
final String filename2 = filename.replaceAll("[\\*\"/\\\\\\[\\]\\:\\;\\|\\=\\,]+", "_"); // Windows
final File file = this.getDataFile(filename2);
this.copyToLocalStorage(stream, file);
log.debug("Stream with digest {} copied to {}", digest, safePath(file));
if ( digest != null ) {
synchronized ( this.digestCache ) {
this.digestCache.put(url, new CacheEntry(file, digest));
}
}
return file;
}