Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
Expand Down Expand Up @@ -197,7 +198,7 @@ private void updateManifest(final File mf) throws IOException {
* @throws IOException if it fails to create the directory
*/
public static File makeTmpDir(final String prefix) throws IOException {
File tmpDir = File.createTempFile(prefix, "");
File tmpDir = Files.createTempFile(prefix, "").toFile();

// create a directory in place of the tmp file.
tmpDir.delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class SunWebXmlParser {
static {
XMLIF = XMLInputFactory.newInstance();
XMLIF.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLIF.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ public void extractZip(ZipInputStream zis) throws IOException {
int size = 0;
while ((ze = zis.getNextEntry()) != null) {
logger.logp(Level.FINER, "Activator", "extractZip", "ZipEntry name = {0}, size = {1}", new Object[]{ze.getName(), ze.getSize()});
java.io.File f = new java.io.File(dest + java.io.File.separator + ze.getName());
java.io.File f = new File(dest, ze.getName());
if (!f.toPath().normalize().startsWith(dest.toPath().normalize())) {
throw new IOException("Bad zip entry");
}
if (ze.isDirectory()) {
if (!f.exists()) {
if (!f.mkdirs()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;

import java.security.SecureRandom;
import java.util.Random;

/**
Expand Down Expand Up @@ -67,7 +68,7 @@ public final class UserNumberBean {
*/
@SuppressWarnings("checkstyle:MagicNumber")
public UserNumberBean() {
Random randomGR = new Random();
Random randomGR = new SecureRandom();
do {
this.randomInt = randomGR.nextInt(10);
} while (this.randomInt == 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,10 @@ public static void extractZip(final ZipInputStream zis, final File destDir)
LOGGER.logp(Level.FINER, "ZipUtil", "extractZip",
"ZipEntry name = {0}, size = {1}",
new Object[]{ze.getName(), ze.getSize()});
java.io.File f = new java.io.File(destDir + java.io.File.separator
+ ze.getName());
java.io.File f = new File(destDir, ze.getName());
if (!f.toPath().normalize().startsWith(destDir.toPath().normalize())) {
throw new IOException("Bad zip entry");
}
if (ze.isDirectory()) {
if (!f.exists()) {
if (!f.mkdirs()) {
Expand Down