GradleUp / shadow

Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
https://www.gradleup.com/shadow/
Apache License 2.0
3.77k stars 396 forks source link

fix: StringIndexOutOfBoundsException when from is emtpy #990

Closed tomasbjerre closed 1 month ago

tomasbjerre commented 1 month ago

When:

  shadowJar {
    relocate "", "whatever"
  }

It crashes with:

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48)
        at java.base/java.lang.String.charAt(String.java:1517)
        at java_lang_CharSequence$charAt$1.call(Unknown Source)
        at com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator.canRelocatePath(SimpleRelocator.groovy:172)
        at com.github.jengelman.gradle.plugins.shadow.relocation.Relocator$canRelocatePath.callCurrent(Unknown Source)
        at com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator.canRelocateClass(SimpleRelocator.groovy:182)
        at com.github.jengelman.gradle.plugins.shadow.relocation.Relocator$canRelocateClass$1.call(Unknown Source)
        at com.github.jengelman.gradle.plugins.shadow.impl.RelocatorRemapper.mapValue(RelocatorRemapper.groovy:69)