fix Typo in 'ConnectionUnexpectedPacketException'
This commit is contained in:
		@ -51,7 +51,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
 | 
			
		||||
        when (val pkg = Package.read(io.first)) {
 | 
			
		||||
            is JsonPackage -> return
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
        }
 | 
			
		||||
@ -87,7 +87,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
                    throw ConnectionInvalidJsonException()
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
        }
 | 
			
		||||
@ -123,7 +123,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
        }
 | 
			
		||||
@ -160,7 +160,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
        }
 | 
			
		||||
@ -182,7 +182,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
        JsonPackage(obj).write(io.second)
 | 
			
		||||
 | 
			
		||||
        when (val pkg = Package.read(io.first)) {
 | 
			
		||||
            is JsonPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is JsonPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is BinaryPackage -> return pkg.content
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
@ -206,7 +206,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
        JsonPackage(obj).write(io.second)
 | 
			
		||||
 | 
			
		||||
        when (val pkg = Package.read(io.first)) {
 | 
			
		||||
            is JsonPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is JsonPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is BinaryPackage -> {
 | 
			
		||||
                return Image(ByteArrayInputStream(pkg.content))
 | 
			
		||||
            }
 | 
			
		||||
@ -252,10 +252,10 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
                        is JsonPackage -> {
 | 
			
		||||
                            if(ipkg.content != JsonPrimitive(true)) {
 | 
			
		||||
                                // Protokoll Assertion failed
 | 
			
		||||
                                throw ConnectionUnexpecedPacketException()
 | 
			
		||||
                                throw ConnectionUnexpectedPacketException()
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
                        is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
                        is ErrorPackage -> throw ConnectionErrorException(ipkg)
 | 
			
		||||
                        else -> throw RuntimeException("Unreachable")
 | 
			
		||||
                    }
 | 
			
		||||
@ -265,7 +265,7 @@ class Connection(val address: InetAddress, val port: Int = 10796) : Closeable {
 | 
			
		||||
                    throw IllegalArgumentException("Image Argument was needed.")
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpecedPacketException()
 | 
			
		||||
            is BinaryPackage -> throw ConnectionUnexpectedPacketException()
 | 
			
		||||
            is ErrorPackage -> throw ConnectionErrorException(pkg)
 | 
			
		||||
            else -> throw RuntimeException("Unreachable")
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -9,7 +9,7 @@ sealed class ConnectionException(override val message : String) : Exception(mess
 | 
			
		||||
class ConnectionErrorException(val errorCode : Int, val errorMessage : String) : ConnectionException("${errorCode} ${errorMessage}") {
 | 
			
		||||
    internal  constructor(err : ErrorPackage) : this(err.code, err.message)
 | 
			
		||||
}
 | 
			
		||||
class ConnectionUnexpecedPacketException  : ConnectionException("Got Unexpected Type of Packet")
 | 
			
		||||
class ConnectionUnexpectedPacketException  : ConnectionException("Got Unexpected Type of Packet")
 | 
			
		||||
class ConnectionInvalidJsonException : ConnectionException("The Format of the Json Received is Unexpected.")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user