mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-04 18:12:54 +01:00
Merge branch 'issue-2251' of https://github.com/chris-sharl/Apktool into chris-sharl-issue-2251
This commit is contained in:
commit
d4b2314e26
@ -16,15 +16,21 @@
|
||||
*/
|
||||
package brut.util;
|
||||
|
||||
import brut.common.BrutException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import brut.common.BrutException;
|
||||
|
||||
/**
|
||||
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
|
||||
@ -79,7 +85,14 @@ abstract public class Jar {
|
||||
if (in == null) {
|
||||
throw new FileNotFoundException(resourcePath);
|
||||
}
|
||||
File fileOut = File.createTempFile(tmpPrefix, null);
|
||||
long n = ThreadLocalRandom.current().nextLong();
|
||||
if (n == Long.MIN_VALUE) {
|
||||
n = 0; // corner case
|
||||
} else {
|
||||
n = Math.abs(n);
|
||||
}
|
||||
String suffix = Long.toString(n) + ".tmp";
|
||||
File fileOut = File.createTempFile(tmpPrefix, suffix);
|
||||
fileOut.deleteOnExit();
|
||||
OutputStream out = new FileOutputStream(fileOut);
|
||||
IOUtils.copy(in, out);
|
||||
|
Loading…
Reference in New Issue
Block a user