<commit_before>/*
 * $Id$
 */
package org.xins.util.ant.sourceforge;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.xins.util.text.FastStringBuffer;

/**
 * Apache Ant task that creates a new XINS release at the SourceForge site.
 *
 * @version $Revision$ $Date$
 * @author <NAME> (<a href="mailto:<EMAIL>"><EMAIL></a>)
 *
 * @since XINS 0.127
 */
public final class AddReleaseTask extends Task {

   //-------------------------------------------------------------------------
   // Class fields
   //-------------------------------------------------------------------------

   /**
    * The FTP server to upload the distribution files to.
    */
   private static final String FTP_SERVER = "upload.sourceforge.net";

   /**
    * The directory on the FTP server to upload the distribution files to.
    */
   private static final String FTP_DIR = "incoming";

   /**
    * The base URL for adding a release to a SourceForge package.
    */
   private static final String ADD_RELEASE_URL = "https://sourceforge.net/project/admin/newrelease.php";

   /**
    * The <em>debug</em> log level.
    */
   //private static int DEBUG = Project.MSG_DEBUG;
   private static int DEBUG = Project.MSG_INFO;

   /**
    * The <em>verbose</em> log level.
    */
   //private static int VERBOSE = Project.MSG_VERBOSE;
   private static int VERBOSE = Project.MSG_INFO;

   /**
    * The <em>information</em> log level.
    */
   private static int INFO = Project.MSG_INFO;

   /**
    * The <em>error</em> log level.
    */
   private static int ERROR = Project.MSG_ERR;


   //-------------------------------------------------------------------------
   // Class functions
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Constructors
   //-------------------------------------------------------------------------

   /**
    * Constructs a new <code>AddReleaseTask</code>.
    */
   public AddReleaseTask() {
      HttpState httpState = new HttpState();
      httpState.setCookiePolicy(CookiePolicy.COMPATIBILITY);

      _httpClient = new HttpClient();
      _httpClient.setConnectionTimeout(9000); // 7 seconds
      _httpClient.setTimeout(7000);           // 5 seconds
      _httpClient.setState(httpState);
   }


   //-------------------------------------------------------------------------
   // Fields
   //-------------------------------------------------------------------------

   /**
    * The SourceForge user to log in as.
    */
   private String _user;

   /**
    * The password for the SourceForge user to log in as.
    */<commit_msg>Small comment fixes.<commit_after>/*
 * $Id$
 */
package org.xins.util.ant.sourceforge;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.xins.util.text.FastStringBuffer;

/**
 * Apache Ant task that creates a new XINS release at the SourceForge site.
 *
 * @version $Revision$ $Date$
 * @author <NAME> (<a href="mailto:<EMAIL>"><EMAIL></a>)
 *
 * @since XINS 0.127
 */
public final class AddReleaseTask extends Task {

   //-------------------------------------------------------------------------
   // Class fields
   //-------------------------------------------------------------------------

   /**
    * The FTP server to upload the distribution files to.
    */
   private static final String FTP_SERVER = "upload.sourceforge.net";

   /**
    * The directory on the FTP server to upload the distribution files to.
    */
   private static final String FTP_DIR = "incoming";

   /**
    * The base URL for adding a release to a SourceForge package.
    */
   private static final String ADD_RELEASE_URL = "https://sourceforge.net/project/admin/newrelease.php";

   /**
    * The <em>debug</em> log level.
    */
   //private static int DEBUG = Project.MSG_DEBUG;
   private static int DEBUG = Project.MSG_INFO;

   /**
    * The <em>verbose</em> log level.
    */
   //private static int VERBOSE = Project.MSG_VERBOSE;
   private static int VERBOSE = Project.MSG_INFO;

   /**
    * The <em>information</em> log level.
    */
   private static int INFO = Project.MSG_INFO;

   /**
    * The <em>error</em> log level.
    */
   private static int ERROR = Project.MSG_ERR;


   //-------------------------------------------------------------------------
   // Class functions
   //-------------------------------------------------------------------------

   //-------------------------------------------------------------------------
   // Constructors
   //-------------------------------------------------------------------------

   /**
    * Constructs a new <code>AddReleaseTask</code>.
    */
   public AddReleaseTask() {
      HttpState httpState = new HttpState();
      httpState.setCookiePolicy(CookiePolicy.COMPATIBILITY);

      _httpClient = new HttpClient();
      _httpClient.setConnectionTimeout(9000); // 9 seconds
      _httpClient.setTimeout(7000);           // 7 seconds
      _httpClient.setState(httpState);
   }


   //-------------------------------------------------------------------------
   // Fields
   //-------------------------------------------------------------------------

   /**
    * The SourceForge user to log in as.
    */
   private String _user;

   /**
    * The password for the SourceForge user to log in as.
    */
{'fraction_non_alphanumeric': 0.2634221168595733, 'fraction_numerical': 0.005578022590991494, 'mean_word_length': 1.7228549734244496, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6647388', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1856, 'n_words': 450}