in src/main/java/org/apache/sling/launchpad/base/impl/Sling.java [871:911]
private void copyBootstrapCommandFile(final Map<String, String> props) {
// check last modification date
final URL url = this.resourceProvider.getResource(BootstrapInstaller.BOOTSTRAP_CMD_FILENAME);
if ( url != null ) {
this.logger.log(Logger.LOG_DEBUG, "Checking last modification date of bootstrap command file.");
InputStream is = null;
OutputStream os = null;
try {
final long lastModified = url.openConnection().getLastModified();
final File launchpadHome = new File(props.get(SharedConstants.SLING_LAUNCHPAD));
final File cmdFile = new File(launchpadHome, BootstrapInstaller.BOOTSTRAP_CMD_FILENAME);
boolean copyFile = true;
if ( cmdFile.exists() && cmdFile.lastModified() >= lastModified ) {
copyFile = false;
}
if ( copyFile ) {
this.logger.log(Logger.LOG_INFO, "Copying bootstrap command file.");
is = this.resourceProvider.getResourceAsStream(BootstrapInstaller.BOOTSTRAP_CMD_FILENAME);
os = new FileOutputStream(cmdFile);
final byte[] buffer = new byte[2048];
int l;
while ( (l = is.read(buffer, 0, buffer.length)) != -1 ) {
os.write(buffer, 0, l);
}
}
} catch (final IOException ioe) {
this.logger.log(Logger.LOG_INFO, "Ignoring exception during processing of bootstrap command file.", ioe);
} finally {
if ( is != null ) {
try { is.close(); } catch (final IOException ignore) {}
}
if ( os != null ) {
try { os.close(); } catch (final IOException ignore) {}
}
}
} else {
this.logger.log(Logger.LOG_DEBUG, "Bootstrap command file not found.");
}
}