public static void uploadWebConfig(WebApp webApp, InputStream fileStream, IProgressIndicator indicator) throws IOException {
FTPClient ftp = null;
try {
if(indicator != null) indicator.setText("Stopping the service...");
webApp.stop();
PublishingProfile pp = webApp.getPublishingProfile();
ftp = getFtpConnection(pp);
if(indicator != null) indicator.setText("Uploading " + webConfigFilename + "...");
uploadFileToFtp(ftp, ftpRootPath + webConfigFilename, fileStream, indicator);
if(indicator != null) indicator.setText("Starting the service...");
webApp.start();
} finally {
if (ftp != null && ftp.isConnected()) {
ftp.disconnect();
}
}
}