in src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java [469:520]
private void readSlingBootstrap(final File bootstrapFile, final int mode) throws MojoExecutionException {
if (bootstrapFile.exists()) {
File tmp = null;
Reader reader = null;
try {
tmp = File.createTempFile("sling", "bootstrap");
mavenFileFilter.copyFile(bootstrapFile, tmp, true, project, Collections.EMPTY_LIST, true,
System.getProperty("file.encoding"), mavenSession);
reader = new FileReader(tmp);
final StringBuilder sb = new StringBuilder();
if ( mode == 0 ) {
if ( this.slingBootstrapCommand != null ) {
sb.append(this.slingBootstrapCommand);
}
} else if ( mode == 1 ) {
if ( this.slingWebappBootstrapCommand != null ) {
sb.append(this.slingWebappBootstrapCommand);
}
} else {
if ( this.slingStandaloneBootstrapCommand != null ) {
sb.append(this.slingStandaloneBootstrapCommand);
}
}
final char[] buffer = new char[2048];
int l;
while ( (l = reader.read(buffer, 0, buffer.length) ) != -1 ) {
sb.append(buffer, 0, l);
}
sb.append('\n');
if ( mode == 0 ) {
this.slingBootstrapCommand = sb.toString();
} else if ( mode == 1 ) {
this.slingWebappBootstrapCommand = sb.toString();
} else {
this.slingStandaloneBootstrapCommand = sb.toString();
}
} catch (final IOException e) {
throw new MojoExecutionException("Unable to create filtered bootstrap file", e);
} catch (final MavenFilteringException e) {
throw new MojoExecutionException("Unable to create filtered bootstrap file", e);
} finally {
if (tmp != null) {
tmp.delete();
}
if ( reader != null ) {
try {
reader.close();
} catch (final IOException ignore) {}
}
}
}
}