Program: 162534
Project: 162534
Buggy source:
@Override public void run(){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(this);
  FtpServerFactory serverFactory=new FtpServerFactory();
  ConnectionConfigFactory connectionConfigFactory=new ConnectionConfigFactory();
  connectionConfigFactory.setAnonymousLoginEnabled(true);
  serverFactory.setConnectionConfig(connectionConfigFactory.createConnectionConfig());
  String usernamePreference=preferences.getString(KEY_PREFERENCE_USERNAME,DEFAULT_USERNAME);
  if (!usernamePreference.equals(DEFAULT_USERNAME)) {
    username=usernamePreference;
    password=preferences.getString(KEY_PREFERENCE_PASSWORD,"String_Node_Str");
    isPasswordProtected=true;
  }
  BaseUser user=new BaseUser();
  if (!isPasswordProtected) {
    user.setName("String_Node_Str");
  }
 else {
    user.setName(username);
    user.setPassword(password);
  }
  user.setHomeDirectory(preferences.getString(KEY_PREFERENCE_PATH,DEFAULT_PATH));
  List<Authority> list=new ArrayList<>();
  list.add(new WritePermission());
  user.setAuthorities(list);
  try {
    serverFactory.getUserManager().save(user);
  }
 catch (  FtpException e) {
    e.printStackTrace();
  }
  ListenerFactory fac=new ListenerFactory();
  port=preferences.getInt(PORT_PREFERENCE_KEY,DEFAULT_PORT);
  if (preferences.getBoolean(KEY_PREFERENCE_SECURE,DEFAULT_SECURE)) {
    SslConfigurationFactory sslConfigurationFactory=new SslConfigurationFactory();
    File file;
    try {
      InputStream stream=getResources().openRawResource(R.raw.key);
      file=File.createTempFile("String_Node_Str","String_Node_Str");
      FileOutputStream outputStream=new FileOutputStream(file);
      IOUtils.copy(stream,outputStream);
    }
 catch (    Exception e) {
      e.printStackTrace();
      file=null;
    }
    if (file != null) {
      sslConfigurationFactory.setKeystoreFile(file);
      sslConfigurationFactory.setKeystorePassword("String_Node_Str");
      fac.setSslConfiguration(sslConfigurationFactory.createSslConfiguration());
      fac.setImplicitSsl(true);
    }
 else {
      preferences.edit().putBoolean(KEY_PREFERENCE_SECURE,false).apply();
    }
  }
  fac.setPort(port);
  fac.setIdleTimeout(preferences.getInt(KEY_PREFERENCE_TIMEOUT,DEFAULT_TIMEOUT));
  serverFactory.addListener("String_Node_Str",fac.createListener());
  try {
    server=serverFactory.createServer();
    server.start();
    sendBroadcast(new Intent(FTPService.ACTION_STARTED));
  }
 catch (  Exception e) {
    sendBroadcast(new Intent(FTPService.ACTION_FAILEDTOSTART));
  }
}

Fixed version (ground truth):
@Override public void run(){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(this);
  FtpServerFactory serverFactory=new FtpServerFactory();
  ConnectionConfigFactory connectionConfigFactory=new ConnectionConfigFactory();
  connectionConfigFactory.setAnonymousLoginEnabled(true);
  serverFactory.setConnectionConfig(connectionConfigFactory.createConnectionConfig());
  String usernamePreference=preferences.getString(KEY_PREFERENCE_USERNAME,DEFAULT_USERNAME);
  if (!usernamePreference.equals(DEFAULT_USERNAME)) {
    username=usernamePreference;
    password=preferences.getString(KEY_PREFERENCE_PASSWORD,"String_Node_Str");
    isPasswordProtected=true;
  }
  BaseUser user=new BaseUser();
  if (!isPasswordProtected) {
    user.setName("String_Node_Str");
  }
 else {
    user.setName(username);
    user.setPassword(password);
  }
  user.setHomeDirectory(preferences.getString(KEY_PREFERENCE_PATH,DEFAULT_PATH));
  List<Authority> list=new ArrayList<>();
  list.add(new WritePermission());
  user.setAuthorities(list);
  try {
    serverFactory.getUserManager().save(user);
  }
 catch (  FtpException e) {
    e.printStackTrace();
  }
  ListenerFactory fac=new ListenerFactory();
  if (preferences.getBoolean(KEY_PREFERENCE_SECURE,DEFAULT_SECURE)) {
    SslConfigurationFactory sslConfigurationFactory=new SslConfigurationFactory();
    File file;
    try {
      InputStream stream=getResources().openRawResource(R.raw.key);
      file=File.createTempFile("String_Node_Str","String_Node_Str");
      FileOutputStream outputStream=new FileOutputStream(file);
      IOUtils.copy(stream,outputStream);
    }
 catch (    Exception e) {
      e.printStackTrace();
      file=null;
    }
    if (file != null) {
      sslConfigurationFactory.setKeystoreFile(file);
      sslConfigurationFactory.setKeystorePassword("String_Node_Str");
      fac.setSslConfiguration(sslConfigurationFactory.createSslConfiguration());
      fac.setImplicitSsl(true);
    }
 else {
      preferences.edit().putBoolean(KEY_PREFERENCE_SECURE,false).apply();
    }
  }
  fac.setPort(preferences.getInt(PORT_PREFERENCE_KEY,DEFAULT_PORT));
  fac.setIdleTimeout(preferences.getInt(KEY_PREFERENCE_TIMEOUT,DEFAULT_TIMEOUT));
  serverFactory.addListener("String_Node_Str",fac.createListener());
  try {
    server=serverFactory.createServer();
    server.start();
    sendBroadcast(new Intent(FTPService.ACTION_STARTED));
  }
 catch (  Exception e) {
    sendBroadcast(new Intent(FTPService.ACTION_FAILEDTOSTART));
  }
}