fix(RelocateJar): ZipException due to duplicate files
This commit is contained in:
parent
a3445b4482
commit
47fa2ddc0a
|
|
@ -18,6 +18,7 @@ import java.util.jar.JarEntry
|
||||||
import java.util.jar.JarFile
|
import java.util.jar.JarFile
|
||||||
import java.util.jar.JarOutputStream
|
import java.util.jar.JarOutputStream
|
||||||
import java.util.stream.Collectors
|
import java.util.stream.Collectors
|
||||||
|
import java.util.zip.ZipException
|
||||||
|
|
||||||
@ToString
|
@ToString
|
||||||
class RelocateJar extends DefaultTask {
|
class RelocateJar extends DefaultTask {
|
||||||
|
|
@ -61,10 +62,20 @@ class RelocateJar extends DefaultTask {
|
||||||
remapper.remapper = rem
|
remapper.remapper = rem
|
||||||
reader.accept(rem, 0)
|
reader.accept(rem, 0)
|
||||||
isolated.putAll(visitor.isolated)
|
isolated.putAll(visitor.isolated)
|
||||||
|
try {
|
||||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||||
|
} catch(ZipException zipException) {
|
||||||
|
println(zipException)
|
||||||
|
return true
|
||||||
|
}
|
||||||
out.write(writer.toByteArray())
|
out.write(writer.toByteArray())
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
out.putNextEntry(new JarEntry(remapper.map(jarEntry.name)))
|
||||||
|
} catch(ZipException zipException) {
|
||||||
|
println(zipException)
|
||||||
|
return true
|
||||||
|
}
|
||||||
while ((n = it.read(buf)) != -1) {
|
while ((n = it.read(buf)) != -1) {
|
||||||
out.write(buf, 0, n)
|
out.write(buf, 0, n)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue