Author: markt Date: Tue Mar 21 23:13:11 2017 New Revision: 1788034 URL: http://svn.apache.org/viewvc?rev=1788034&view=rev Log: Trivial commit to test CI system
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java?rev=1788034&r1=1788033&r2=1788034&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/ant/AbstractCatalinaTask.java Tue Mar 21 23:13:11 2017 @@ -14,11 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - package org.apache.catalina.ant; - import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; @@ -32,21 +29,18 @@ import org.apache.tomcat.util.codec.bina import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; - /** - * Abstract base class for Ant tasks that interact with the - * <em>Manager</em> web application for dynamically deploying and - * undeploying applications. These tasks require Ant 1.4 or later. + * Abstract base class for Ant tasks that interact with the <em>Manager</em> web + * application for dynamically deploying and undeploying applications. These + * tasks require Ant 1.4 or later. * * @author Craig R. McClanahan * @since 4.1 */ public abstract class AbstractCatalinaTask extends BaseRedirectorHelperTask { - // ----------------------------------------------------- Instance Variables - /** * manager webapp's encoding. */ @@ -55,56 +49,52 @@ public abstract class AbstractCatalinaTa // ------------------------------------------------------------- Properties - /** * The charset used during URL encoding. */ protected String charset = "ISO-8859-1"; public String getCharset() { - return (this.charset); + return this.charset; } public void setCharset(String charset) { this.charset = charset; } - /** * The login password for the <code>Manager</code> application. */ protected String password = null; public String getPassword() { - return (this.password); + return this.password; } public void setPassword(String password) { this.password = password; } - /** * The URL of the <code>Manager</code> application to be used. */ protected String url = "http://localhost:8080/manager/text"; public String getUrl() { - return (this.url); + return this.url; } public void setUrl(String url) { this.url = url; } - /** * The login username for the <code>Manager</code> application. */ protected String username = null; public String getUsername() { - return (this.username); + return this.username; } public void setUsername(String username) { @@ -116,9 +106,9 @@ public abstract class AbstractCatalinaTa * message that must be "OK -". * <p> * When this attribute is set to {@code false} (the default), the first line - * of server response is expected to start with "OK -". If it does not - * then the task is considered as failed and the first line is treated - * as an error message. + * of server response is expected to start with "OK -". If it does not then + * the task is considered as failed and the first line is treated as an + * error message. * <p> * When this attribute is set to {@code true}, the first line of the * response is treated like any other, regardless of its text. @@ -136,28 +126,21 @@ public abstract class AbstractCatalinaTa // --------------------------------------------------------- Public Methods - /** - * Execute the specified command. This logic only performs the common - * attribute validation required by all subclasses; it does not perform - * any functional logic directly. + * Execute the specified command. This logic only performs the common + * attribute validation required by all subclasses; it does not perform any + * functional logic directly. * * @exception BuildException if a validation error occurs */ @Override public void execute() throws BuildException { - if ((username == null) || (password == null) || (url == null)) { - throw new BuildException - ("Must specify all of 'username', 'password', and 'url'"); + throw new BuildException("Must specify all of 'username', 'password', and 'url'"); } - } - // ------------------------------------------------------ Protected Methods - - /** * Execute the specified command, based on the configured properties. * @@ -166,16 +149,14 @@ public abstract class AbstractCatalinaTa * @exception BuildException if an error occurs */ public void execute(String command) throws BuildException { - execute(command, null, null, -1); - } /** - * Execute the specified command, based on the configured properties. - * The input stream will be closed upon completion of this task, whether - * it was executed successfully or not. + * Execute the specified command, based on the configured properties. The + * input stream will be closed upon completion of this task, whether it was + * executed successfully or not. * * @param command Command to be executed * @param istream InputStream to include in an HTTP PUT, if any @@ -184,9 +165,8 @@ public abstract class AbstractCatalinaTa * * @exception BuildException if an error occurs */ - public void execute(String command, InputStream istream, - String contentType, long contentLength) - throws BuildException { + public void execute(String command, InputStream istream, String contentType, long contentLength) + throws BuildException { URLConnection conn = null; InputStreamReader reader = null; @@ -207,8 +187,7 @@ public abstract class AbstractCatalinaTa hconn.setRequestProperty("Content-Type", contentType); } if (contentLength >= 0) { - hconn.setRequestProperty("Content-Length", - "" + contentLength); + hconn.setRequestProperty("Content-Length", "" + contentLength); hconn.setFixedLengthStreamingMode(contentLength); } @@ -216,23 +195,20 @@ public abstract class AbstractCatalinaTa hconn.setDoOutput(false); hconn.setRequestMethod("GET"); } - hconn.setRequestProperty("User-Agent", - "Catalina-Ant-Task/1.0"); + hconn.setRequestProperty("User-Agent", "Catalina-Ant-Task/1.0"); // Set up an authorization header with our credentials String input = username + ":" + password; - String output = Base64.encodeBase64String( - input.getBytes(StandardCharsets.ISO_8859_1)); - hconn.setRequestProperty("Authorization", - "Basic " + output); + String output = Base64.encodeBase64String(input.getBytes(StandardCharsets.ISO_8859_1)); + hconn.setRequestProperty("Authorization", "Basic " + output); // Establish the connection with the server hconn.connect(); // Send the request data (if any) if (istream != null) { - try (BufferedOutputStream ostream = - new BufferedOutputStream(hconn.getOutputStream(), 1024);) { + try (BufferedOutputStream ostream = new BufferedOutputStream( + hconn.getOutputStream(), 1024);) { byte buffer[] = new byte[1024]; while (true) { int n = istream.read(buffer); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org