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

NumberFormatException when pattern contains trailing or duplicated space #126

Closed
centralhardware opened this issue Nov 2, 2024 · 2 comments · Fixed by #128
Closed

NumberFormatException when pattern contains trailing or duplicated space #126

centralhardware opened this issue Nov 2, 2024 · 2 comments · Fixed by #128

Comments

@centralhardware
Copy link

centralhardware commented Nov 2, 2024

suspend fun main() {
    doOnceTz("* * * * * * ") {

    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:565)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseYears(Parser.kt:42)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:113)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:10)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

suspend fun main() {
    doOnce(" * * * * * *") {

    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:565)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseSeconds(Parser.kt:47)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:119)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:11)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

suspend fun main() {
    doOnce("*  * * * * *") {

    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:565)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseMinutes(Parser.kt:46)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:120)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:10)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

suspend fun main() {
    doOnce("sdf * * * * *") {

    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: "sd0"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:588)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseSeconds(Parser.kt:47)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:119)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:10)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

Process finished with exit code 1

suspend fun main() {
    doOnce("* * * * * * oo") {
        println("sdf")
    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: "oo"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:588)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseYears(Parser.kt:42)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:113)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:14)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

Process finished with exit code 1

Copy link

github-actions bot commented Nov 2, 2024

Welcome with your first issue

@centralhardware centralhardware changed the title NumberFormatException when pattern contains trailing space NumberFormatException when pattern contains trailing or duplicated space Nov 2, 2024
InsanusMokrassar added a commit that referenced this issue Nov 3, 2024
@InsanusMokrassar InsanusMokrassar linked a pull request Nov 3, 2024 that will close this issue
@centralhardware
Copy link
Author

centralhardware commented Nov 3, 2024

suspend fun main() {
    doOnce("0, * * * *") {
        println("sdf")
    }
}
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
	at java.base/java.lang.Integer.parseInt(Integer.java:565)
	at java.base/java.lang.Integer.parseInt(Integer.java:685)
	at dev.inmo.krontab.internal.ParserKt.createSimpleScheduler(Parser.kt:33)
	at dev.inmo.krontab.internal.ParserKt.parseSeconds(Parser.kt:117)
	at dev.inmo.krontab.KrontabConfig.scheduler-impl(KrontabConfig.kt:130)
	at dev.inmo.krontab.StringParserKt.createSimpleScheduler(StringParser.kt:77)
	at dev.inmo.krontab.StringParserKt.buildSchedule(StringParser.kt:87)
	at me.centralhardware.telegram.MainKt.main(Main.kt:10)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at me.centralhardware.telegram.MainKt$main$3.invoke(Main.kt)
	at kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt$createCoroutineUnintercepted$$inlined$createCoroutineFromSuspendFunction$IntrinsicsKt__IntrinsicsJvmKt$1.invokeSuspend(IntrinsicsJvm.kt:223)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlin.coroutines.ContinuationKt.startCoroutine(Continuation.kt:115)
	at kotlin.coroutines.jvm.internal.RunSuspendKt.runSuspend(RunSuspend.kt:19)
	at me.centralhardware.telegram.MainKt.main(Main.kt)

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

Successfully merging a pull request may close this issue.

1 participant