1

I have a script written in Clojure using babashka that does some text processing. It works fine if I run it with bb command. But when I compile it to a .jar file and run using java command I get java.lang.StackOverflowError.

Exception in thread "main" java.lang.StackOverflowError
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3789)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4618)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4672)
    .....

I was able to identify that the problem is caused by this \s(?=([^\"]|\"[^\"]*\")*$) regular expression. Which I use to split a string by whitespaces excluding the ones inside quoted strings like that ("a string that is not splitted").

How do I need to update that regex so it would work in Java after compilation to a .jar file?

3
  • Are you able to reproduce the issue by running the Clojure script with clj or lein? What version of Java (e.g. java -version) are you using to run the Jar file? Jun 23, 2020 at 7:26
  • I'm using Java 8 to run it. And my script consists of a few files so I'm not sure how to properly run it with clj or lein Jun 23, 2020 at 7:43
  • 2
    Please add precise code and sample data to repro Jun 23, 2020 at 14:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.