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

NamespaceDiscovery.findNamespaceInFile String index out of range #119

Open
craigworrall opened this issue Aug 26, 2019 · 1 comment
Open

Comments

@craigworrall
Copy link

Using version 1.8.3.
The stack trace below seems to occur when a file is found in a source dir, and the file name and ns symbol within do not correspond. In my case, the file was not even a ".clj" file, but had clj source.

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -45
at java.lang.String.substring (String.java:1967)
at com.theoryinpractise.clojure.NamespaceDiscovery.findNamespaceInFile (NamespaceDiscovery.java:161)
at com.theoryinpractise.clojure.NamespaceDiscovery.discoverNamespacesIn (NamespaceDiscovery.java:133)
at com.theoryinpractise.clojure.NamespaceDiscovery.discoverNamespacesInPath (NamespaceDiscovery.java:108)
at com.theoryinpractise.clojure.NamespaceDiscovery.discoverNamespacesIn (NamespaceDiscovery.java:75)

@emilianbold
Copy link

emilianbold commented Jan 2, 2020

The plugin doesn't read the ns, it just infers it from the file name, see https://github.com/talios/clojure-maven-plugin/blob/develop/src/main/java/com/theoryinpractise/clojure/NamespaceDiscovery.java#L160

It also assumes the file name has an extension which isn't necessarily the case.

The correct solution is to actually read the ns but doing that right is probably rather heavy. Some heuristics could be added though...

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

2 participants