Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "pojo.asDer" is null #14

Open
ditlef9 opened this issue Dec 7, 2021 · 0 comments

Comments

@ditlef9
Copy link

ditlef9 commented Dec 7, 2021

I am using the Java sources in Kotlin. I get the following errors on a lot of the messages:


java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "pojo.asDer" is null
	at io.calidog.certstream.CertStreamCertificate.fromPOJO(CertStreamCertificate.java:37)
	at io.calidog.certstream.CertStreamMessageData.fromPOJO(CertStreamMessageData.java:37)
	at io.calidog.certstream.CertStreamMessage.fromPOJO(CertStreamMessage.java:22)
	at io.calidog.certstream.CertStream.lambda$onMessage$1(CertStream.java:74)
	at io.calidog.certstream.CertStreamClientImplFactory$1.onMessage(CertStreamClientImplFactory.java:46)
	at io.calidog.certstream.CertStreamClientImpl.onMessage(CertStreamClientImpl.java:35)
	at org.java_websocket.client.WebSocketClient.onWebsocketMessage(WebSocketClient.java:342)
	at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:599)
	at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:370)
	at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:202)
	at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:278)
	at java.base/java.lang.Thread.run(Thread.java:833)

This is my Main.kt:

import com.google.gson.Gson
import io.calidog.certstream.CertStream
import io.calidog.certstream.CertStreamMessage


fun main(args: Array<String>) {

    try {
        CertStream.onMessageString { x: String? ->
            if(!(x.isNullOrEmpty())){
                println(x)
            }
        }
        CertStream.onMessage { msg: CertStreamMessage? ->
            println(Gson().toJson(msg))
        }
    } catch (ex: Exception){
        print("Exeption" + ex.message)
    }
}

build.gradle.kts

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.6.0"
    application
}

group = "me.admin"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.google.code.gson:gson:2.8.9")
    testImplementation(kotlin("test"))
    implementation("com.github.CaliDog:certstream-java:0.3")
}

tasks.test {
    useJUnit()
}

tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "1.8"
}

application {
    mainClass.set("MainKt")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant