mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-05-01 04:34:45 +02:00
continued work on threading and code improvement
This commit is contained in:
@@ -94,10 +94,5 @@ Copyright (c) 2014 - Jeremy Long. All Rights Reserved.
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.findbugs</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -25,12 +25,14 @@ import java.io.ObjectStreamClass;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.annotation.concurrent.NotThreadSafe;
|
||||
|
||||
/**
|
||||
* An ObjectInputStream that will only deserialize expected classes.
|
||||
*
|
||||
* @author Jeremy Long
|
||||
*/
|
||||
@NotThreadSafe
|
||||
public class ExpectedObjectInputStream extends ObjectInputStream {
|
||||
|
||||
/**
|
||||
|
||||
@@ -445,12 +445,15 @@ public final class Settings {
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/**
|
||||
* Initialize the settings object.
|
||||
*/
|
||||
public Settings() {
|
||||
initialize(PROPERTIES_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* This class loads the settings from the given properties file.
|
||||
* Initialize the settings object using the given properties file.
|
||||
*
|
||||
* @param propertiesFilePath the path to the base properties file to load
|
||||
*/
|
||||
@@ -463,7 +466,7 @@ public final class Settings {
|
||||
*
|
||||
* @param propertiesFilePath the path to the settings property file
|
||||
*/
|
||||
private final void initialize(String propertiesFilePath) {
|
||||
private void initialize(String propertiesFilePath) {
|
||||
props = new Properties();
|
||||
try (InputStream in = FileUtils.getResourceAsStream(propertiesFilePath)) {
|
||||
props.load(in);
|
||||
@@ -970,8 +973,7 @@ public final class Settings {
|
||||
throw new IOException(String.format("Unable to create the data directory '%s'",
|
||||
(path == null) ? "unknown" : path.getAbsolutePath()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Generates a new temporary file name that is guaranteed to be unique.
|
||||
*
|
||||
|
||||
@@ -46,7 +46,6 @@ public class ExpectedObjectInputStreamTest {
|
||||
out.writeObject(data);
|
||||
out.flush();
|
||||
byte[] buf = mem.toByteArray();
|
||||
out.close();
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(buf);
|
||||
ExpectedObjectInputStream instance = new ExpectedObjectInputStream(in, "java.util.ArrayList", "org.owasp.dependencycheck.utils.SimplePojo", "java.lang.Integer", "java.lang.Number");
|
||||
instance.readObject();
|
||||
|
||||
@@ -23,6 +23,10 @@ import java.io.Serializable;
|
||||
* @author jeremy
|
||||
*/
|
||||
public class SimplePojo implements Serializable {
|
||||
/**
|
||||
* The serial version UID for serialization.
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String s = "3";
|
||||
public Integer i = 3;
|
||||
|
||||
Reference in New Issue
Block a user