<commit_before>package edu.csh.chase.sprint.websockets

import edu.csh.chase.sprint.*
import edu.csh.chase.sprint.parameters.UrlParameters
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.WebSocketListener
import okio.Buffer
import okio.ByteString
import java.io.IOException
import java.util.*
import java.util.concurrent.TimeUnit
import okhttp3.Response as OkResponse
import okhttp3.WebSocket as OkWebSocket

abstract class WebSocket(protected val request: Request,
                         client: OkHttpClient = Sprint.webSocketClient,
                         val retryCount: Int = 4,
                         val autoConnect: Boolean = false) : WebSocketCallbacks {

    private val listeners: ArrayList<WebSocketCallbacks> = ArrayList()
    private var socket: OkWebSocket? = null
    private var currentRetry: Int = retryCount
    private val client: OkHttpClient

    private val listenerCallBacks = object : WebSocketListener() {

        override fun onOpen(webSocket: OkWebSocket, response: OkResponse) {
            this@WebSocket.onOpen(webSocket, response)
        }

        override fun onMessage(webSocket: okhttp3.WebSocket, text: String) {
            this@WebSocket.onMessage(text)
        }

        override fun onMessage(webSocket: okhttp3.WebSocket, bytes: ByteString) {
        }

        override fun onClosing(webSocket: okhttp3.WebSocket, code: Int, reason: String) {
        }

        override fun onClosed(webSocket: okhttp3.WebSocket, code: Int, reason: String) {
            this@WebSocket.onClose(code, reason)
        }

        override fun onFailure(webSocket: okhttp3.WebSocket?, t: Throwable?, response: okhttp3.Response?) {
            this@WebSocket.onFailure(IOException(t), response!!)
        }
    }

    var state: State = State.Disconnected
        private set

    enum class State {
        Connecting,
        Connected,
        Disconnecting,
        Disconnected,
        Errored//Functions the same as Disconnected, just notes that an error has occurred
    }<commit_msg>Fixed a kotlin NPE<commit_after>package edu.csh.chase.sprint.websockets

import edu.csh.chase.sprint.*
import edu.csh.chase.sprint.parameters.UrlParameters
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.WebSocketListener
import okio.Buffer
import okio.ByteString
import java.io.IOException
import java.util.*
import java.util.concurrent.TimeUnit
import okhttp3.Response as OkResponse
import okhttp3.WebSocket as OkWebSocket

abstract class WebSocket(protected val request: Request,
                         client: OkHttpClient = Sprint.webSocketClient,
                         val retryCount: Int = 4,
                         val autoConnect: Boolean = false) : WebSocketCallbacks {

    private val listeners: ArrayList<WebSocketCallbacks> = ArrayList()
    private var socket: OkWebSocket? = null
    private var currentRetry: Int = retryCount
    private val client: OkHttpClient

    private val listenerCallBacks = object : WebSocketListener() {

        override fun onOpen(webSocket: OkWebSocket, response: OkResponse) {
            this@WebSocket.onOpen(webSocket, response)
        }

        override fun onMessage(webSocket: okhttp3.WebSocket, text: String) {
            this@WebSocket.onMessage(text)
        }

        override fun onMessage(webSocket: okhttp3.WebSocket, bytes: ByteString) {
        }

        override fun onClosing(webSocket: okhttp3.WebSocket, code: Int, reason: String) {
        }

        override fun onClosed(webSocket: okhttp3.WebSocket, code: Int, reason: String) {
            this@WebSocket.onClose(code, reason)
        }

        override fun onFailure(webSocket: okhttp3.WebSocket?, t: Throwable?, response: okhttp3.Response?) {
            this@WebSocket.onFailure(IOException(t), response)
        }
    }

    var state: State = State.Disconnected
        private set

    enum class State {
        Connecting,
        Connected,
        Disconnecting,
        Disconnected,
        Errored//Functions the same as Disconnected, just notes that an error has occurred
    }
{'fraction_non_alphanumeric': 0.07637698898408812, 'fraction_numerical': 0.00587515299877601, 'mean_word_length': 2.8547169811320754, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '136205', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1102, 'n_words': 295}