covers1624 / WorkspaceTool

MIT License
3 stars 1 forks source link

Jar-in-Jar Dependencies causing `java.lang.StringIndexOutOfBoundsException` #8

Closed ApexModder closed 2 years ago

ApexModder commented 2 years ago

When setting up a workspace and some of the included projects use the Jar-in-Jar (JiJ) system, WST will crash when it comes time to process the IDEA modules, causing java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 5.

This is due to the JiJ dependencies declared in the dependencies block not having _mapped_ in the file names resulting in your "find the dependency version" logic to return -1 and crash WST with index out of bounds.

Debug files _Location in code that is causing the issue_ _https://github.com/covers1624/WorkspaceTool/blob/master/subprojects/forge/src/main/java/net/covers1624/wt/forge/ForgeExtension.java#L171-L172_ _Preview of erroring file when run via IDEA_ ![image](https://user-images.githubusercontent.com/29412632/187056282-de74c07f-d477-4727-bb61-69f743600cce.png) _Log file after running with JiJ dependencies_ [debug.log](https://github.com/covers1624/WorkspaceTool/files/9439047/2022-08-28-3.log)

A potential fix would maybe, be to ignore any JiJ dependencies. These kinds of dependencies are only used by ForgeGradle when building the compiled mod jar and are unrelated to the project setup, these dependencies are also included into the project using the normal gradle include lines implementation fg.deobf('my.package:my-dep:version')

covers1624 commented 2 years ago

Should be Fixed in: https://github.com/covers1624/WorkspaceTool/commit/fe833615583f733ac5aa3e6cccee76613bec95fe