in src/main/java/org/apache/sling/maven/kickstart/run/ControlClient.java [117:149]
private Response sendCommand(final String command) {
if (configure()) {
if (this.secretKey == null) {
logger.info("Missing secret key to protect sending '" + command + "' to " + this.socketAddress);
return new Response(4);
}
Socket socket = null;
try {
socket = new Socket();
socket.connect(this.socketAddress);
writeLine0(socket, this.secretKey + " " + command);
final String result = readLine(socket);
logger.info("Sent '" + command + "' to " + this.socketAddress + ": " + result);
return new Response(0, result);
} catch (final ConnectException ce) {
logger.info("No Apache Sling running at " + this.socketAddress);
return new Response(3, ce);
} catch (final IOException ioe) {
logger.error("Failed sending '" + command + "' to " + this.socketAddress, ioe);
return new Response(1, ioe);
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException ignore) {
}
}
}
}
logger.info("No socket address to send '" + command + "' to");
return new Response(4);
}