<commit_before>package org.basex.api.webdav;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.basex.core.BaseXException;

import org.basex.core.Text;
import org.basex.core.cmd.AlterDB;
import org.basex.core.cmd.Close;
import org.basex.core.cmd.Copy;
import org.basex.core.cmd.DropDB;
import org.basex.server.Query;
import org.basex.server.Session;

/**
 * WebDAV resource representing a collection database.
 * @author BaseX Team 2005-11, BSD License
 * @author <NAME>
 * @author <NAME>
 */
public class BXDatabase extends BXFolder {
  /** Date format of the "Time Stamp" field in INFO DB. */
  private static final DateFormat DATEFORMAT = new SimpleDateFormat(
      "dd.MM.yyyy HH:mm:ss");

  /**
   * Constructor.
   * @param dbname database name
   * @param f resource factory
   * @param u user name
   * @param p user password
   */
  public BXDatabase(final String dbname, final BXResourceFactory f,
      final String u, final String p) {
    super(dbname, "", f, u, p);
  }

  @Override
  public Date getModifiedDate() {
    try {
      final String info;
      final Session s = factory.login(user, pass);
      try {
        final Query q = s.query("declare variable $p as xs:string external; "
            + "db:info($p)");
        q.bind("$p", db);
        info = q.execute();
      } finally {
        s.close();
      }
      // parse the timestamp
      final String timestamp = "Time Stamp: ";
      final int p = info.indexOf(timestamp);
      if(p >= 0) {
        final String date = info.substring(p + timestamp.length(),
            info.indexOf(Text.NL, p));
        if(date.length() > 0) return DATEFORMAT.parse(date);
      }
    } catch(Exception ex) {
      handle(ex);
    }
    return null;
  }

  @Override
  public String getName() {
    return db;
  }

  protected void delete(final Session s) throws BaseXException {
    s.execute(new Close());
    s.execute(new DropDB(db));
  }

  @Override
  protected void rename(final Session s, final String n) throws BaseXException {
    s.execute(new AlterDB(db, n));
  }

  @Override
  protected void copyToRoot(final Session s, final String n)
      throws BaseXException {
    s.execute(new Copy(db, n)); }
  
  protected void moveToRoot(final Session s, final String n)
      throws BaseXException {
    rename(s, n);
  }
}<commit_msg>[FIX] WebDAV: checkstyle warnings<commit_after>package org.basex.api.webdav;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.basex.core.BaseXException;

import org.basex.core.Text;
import org.basex.core.cmd.AlterDB;
import org.basex.core.cmd.Close;
import org.basex.core.cmd.Copy;
import org.basex.core.cmd.DropDB;
import org.basex.server.Query;
import org.basex.server.Session;

/**
 * WebDAV resource representing a collection database.
 * @author BaseX Team 2005-11, BSD License
 * @author <NAME>
 * @author <NAME>
 */
public class BXDatabase extends BXFolder {
  /** Date format of the "Time Stamp" field in INFO DB. */
  private static final DateFormat DATEFORMAT = new SimpleDateFormat(
      "dd.MM.yyyy HH:mm:ss");

  /**
   * Constructor.
   * @param dbname database name
   * @param f resource factory
   * @param u user name
   * @param p user password
   */
  public BXDatabase(final String dbname, final BXResourceFactory f,
      final String u, final String p) {
    super(dbname, "", f, u, p);
  }

  @Override
  public Date getModifiedDate() {
    try {
      final String info;
      final Session s = factory.login(user, pass);
      try {
        final Query q = s.query("declare variable $p as xs:string external; "
            + "db:info($p)");
        q.bind("$p", db);
        info = q.execute();
      } finally {
        s.close();
      }
      // parse the timestamp
      final String timestamp = "Time Stamp: ";
      final int p = info.indexOf(timestamp);
      if(p >= 0) {
        final String date = info.substring(p + timestamp.length(),
            info.indexOf(Text.NL, p));
        if(date.length() > 0) return DATEFORMAT.parse(date);
      }
    } catch(Exception ex) {
      handle(ex);
    }
    return null;
  }

  @Override
  public String getName() {
    return db;
  }

  @Override
  protected void delete(final Session s) throws BaseXException {
    s.execute(new Close());
    s.execute(new DropDB(db));
  }

  @Override
  protected void rename(final Session s, final String n) throws BaseXException {
    s.execute(new AlterDB(db, n));
  }

  @Override
  protected void copyToRoot(final Session s, final String n)
      throws BaseXException {
    s.execute(new Copy(db, n));
  }

  @Override
  protected void moveToRoot(final Session s, final String n)
      throws BaseXException {
    rename(s, n);
  }
}
{'fraction_non_alphanumeric': 0.11933724832214765, 'fraction_numerical': 0.003355704697986577, 'mean_word_length': 2.8274478330658104, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '3308459', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1493, 'n_words': 435}