<commit_before>package unfilteredx

import java.net.URI
import javax.servlet.http.HttpServletRequest
import ems.util.URIBuilder
import unfiltered.request._


object RequestURIBuilder {
  def unapply[A](req: HttpRequest[A]): Option[URIBuilder] = {
    Some(apply(req))
  }

  def apply[A](req: HttpRequest[A]) = {
    val (scheme, host, port) = req match {
      case HostPort(h, 80) => ("http", h, None)
      case HostPort(h, 443) => ("https", h, None)
      case HostPort(h, p) => (if (req.isSecure) "https" else "http", h, Some(p))
      case _ => sys.error("No Host header!!!!")
    }

    URIBuilder(Some(scheme), Some(host), port, Nil, Map()).path(req.uri).copy(params = QueryParams.unapply(req).getOrElse(Map.empty))
  }
}

object RequestURI {
  def unapply[A](req: HttpRequest[A]) : Option[URI] = Some(apply(req))
  def apply[A](req: HttpRequest[A]) = RequestURIBuilder(req).build()
}

object BaseURIBuilder {

  def apply(req: HttpRequest[Any]) = {
    val path = req.underlying match {
      case r: HttpServletRequest => {
        if (r.getContextPath == null) {
          System.getProperty("contextPath", "/")
        }
        else {
          r.getContextPath
        }
      }
      case _ => "/"
    }
    RequestURIBuilder(req).emptyParams().replacePath(path)
  }

  def unapply(req: HttpRequest[Any]): Option[URIBuilder] = Some(apply(req))
}

object BaseURI {
  def unapply[A](req: HttpRequest[A]): Option[URI] = Some(apply(req))
  def apply[A](req: HttpRequest[A]) = BaseURIBuilder(req).build()
}

object RequestContentDisposition {
  def unapply[T](req: HttpRequest[T]) = {
    val value = new StringHeader(ContentDisposition.headerName).unapply(req)
    value.map(ContentDisposition(_)).flatMap(identity)
  }
}
<commit_msg>Now with not checking null<commit_after>package unfilteredx

import java.net.URI
import javax.servlet.http.HttpServletRequest
import ems.util.URIBuilder
import unfiltered.request._


object RequestURIBuilder {
  def unapply[A](req: HttpRequest[A]): Option[URIBuilder] = {
    Some(apply(req))
  }

  def apply[A](req: HttpRequest[A]) = {
    val (scheme, host, port) = req match {
      case HostPort(h, 80) => ("http", h, None)
      case HostPort(h, 443) => ("https", h, None)
      case HostPort(h, p) => (if (req.isSecure) "https" else "http", h, Some(p))
      case _ => sys.error("No Host header!!!!")
    }

    URIBuilder(Some(scheme), Some(host), port, Nil, Map()).path(req.uri).copy(params = QueryParams.unapply(req).getOrElse(Map.empty))
  }
}

object RequestURI {
  def unapply[A](req: HttpRequest[A]) : Option[URI] = Some(apply(req))
  def apply[A](req: HttpRequest[A]) = RequestURIBuilder(req).build()
}

object BaseURIBuilder {

  def apply(req: HttpRequest[Any]) = {
    val path = req.underlying match {
      case r: HttpServletRequest => Option(r.getContextPath).getOrElse(System.getProperty("contextPath", "/"))
      case _ => "/"
    }
    RequestURIBuilder(req).emptyParams().replacePath(path)
  }

  def unapply(req: HttpRequest[Any]): Option[URIBuilder] = Some(apply(req))
}

object BaseURI {
  def unapply[A](req: HttpRequest[A]): Option[URI] = Some(apply(req))
  def apply[A](req: HttpRequest[A]) = BaseURIBuilder(req).build()
}

object RequestContentDisposition {
  def unapply[T](req: HttpRequest[T]) = {
    val value = new StringHeader(ContentDisposition.headerName).unapply(req)
    value.map(ContentDisposition(_)).flatMap(identity)
  }
}

{'fraction_non_alphanumeric': 0.16037459760023412, 'fraction_numerical': 0.0029265437518290896, 'mean_word_length': 4.124437781109445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3012601', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1176, 'n_words': 229}