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

Null for string in regex match should return false #32

Closed
jaccomoc opened this issue Nov 9, 2023 · 0 comments
Closed

Null for string in regex match should return false #32

jaccomoc opened this issue Nov 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@jaccomoc
Copy link
Owner

jaccomoc commented Nov 9, 2023

At the moment null =~ /abc/ gives a NullError but while(null =~ /abc/g) {} throws a NullPointerException:

Invocation error: java.lang.RuntimeException: java.lang.NullPointerException
java.lang.IllegalStateException: Invocation error: java.lang.RuntimeException: java.lang.NullPointerException
at io.jactl.ScriptCompiler.lambda$compileWithCompletion$0(ScriptCompiler.java:60)
at io.jactl.JactlScript.run(JactlScript.java:64)
at io.jactl.JactlScript.lambda$runSync$0(JactlScript.java:93)
at io.jactl.vertx.JactlVertxEnv.lambda$scheduleEvent$1(JactlVertxEnv.java:87)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:259)
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:43)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at io.jactl.ScriptCompiler.lambda$compile$1(ScriptCompiler.java:96)
at io.jactl.ScriptCompiler.lambda$compileWithCompletion$0(ScriptCompiler.java:50)
... 14 more
Caused by: java.lang.NullPointerException
at io.jactl.runtime.RegexMatcher$GlobalMatcher.regexFind(RegexMatcher.java:298)
at io.jactl.runtime.RegexMatcher.regexFind(RegexMatcher.java:165)
at io.jactl.pkg.$j$ScriptF0AA547A286A77B4EDAEB0142622E159.$j$main(_$j$ScriptF0AA547A286A77B4EDAEB0142622E159.jactl:1)
at io.jactl.ScriptCompiler.lambda$compile$1(ScriptCompiler.java:83)
... 15 more
We should just make null matches return false and treat them both consistently.

@jaccomoc jaccomoc added the bug Something isn't working label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant