mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-21 08:39:24 +01:00
removed my previous "correction" for the if statement...
Former-commit-id: 70509cee3c061bfbfad927a0eb72cd32bc40ad6f
This commit is contained in:
@@ -23,12 +23,10 @@ import java.net.HttpURLConnection;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.xpath.XPath;
|
import javax.xml.xpath.XPath;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
import org.owasp.dependencycheck.utils.Downloader;
|
import org.owasp.dependencycheck.utils.Downloader;
|
||||||
import org.owasp.dependencycheck.utils.InvalidSettingException;
|
import org.owasp.dependencycheck.utils.InvalidSettingException;
|
||||||
import org.owasp.dependencycheck.utils.Settings;
|
import org.owasp.dependencycheck.utils.Settings;
|
||||||
@@ -60,16 +58,14 @@ public class NexusSearch {
|
|||||||
/**
|
/**
|
||||||
* Creates a NexusSearch for the given repository URL.
|
* Creates a NexusSearch for the given repository URL.
|
||||||
*
|
*
|
||||||
* @param rootURL
|
* @param rootURL the root URL of the repository on which searches should execute. full URL's are calculated
|
||||||
* the root URL of the repository on which searches should
|
* relative to this URL, so it should end with a /
|
||||||
* execute. full URL's are calculated relative to this URL, so it
|
|
||||||
* should end with a /
|
|
||||||
*/
|
*/
|
||||||
public NexusSearch(URL rootURL) {
|
public NexusSearch(URL rootURL) {
|
||||||
this.rootURL = rootURL;
|
this.rootURL = rootURL;
|
||||||
try {
|
try {
|
||||||
if (null != Settings.getString(Settings.KEYS.PROXY_URL)
|
if (null != Settings.getString(Settings.KEYS.PROXY_URL)
|
||||||
&& null != Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY)) {
|
&& Settings.getBoolean(Settings.KEYS.ANALYZER_NEXUS_PROXY)) {
|
||||||
useProxy = true;
|
useProxy = true;
|
||||||
LOGGER.fine("Using proxy");
|
LOGGER.fine("Using proxy");
|
||||||
} else {
|
} else {
|
||||||
@@ -82,16 +78,13 @@ public class NexusSearch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the configured Nexus repository for the given sha1 hash. If the
|
* Searches the configured Nexus repository for the given sha1 hash. If the artifact is found, a
|
||||||
* artifact is found, a <code>MavenArtifact</code> is populated with the
|
* <code>MavenArtifact</code> is populated with the coordinate information.
|
||||||
* coordinate information.
|
|
||||||
*
|
*
|
||||||
* @param sha1
|
* @param sha1 The SHA-1 hash string for which to search
|
||||||
* The SHA-1 hash string for which to search
|
|
||||||
* @return the populated Maven coordinates
|
* @return the populated Maven coordinates
|
||||||
* @throws IOException
|
* @throws IOException if it's unable to connect to the specified repositor or if the specified artifact is not
|
||||||
* if it's unable to connect to the specified repositor or if
|
* found.
|
||||||
* the specified artifact is not found.
|
|
||||||
*/
|
*/
|
||||||
public MavenArtifact searchSha1(String sha1) throws IOException {
|
public MavenArtifact searchSha1(String sha1) throws IOException {
|
||||||
if (null == sha1 || !sha1.matches("^[0-9A-Fa-f]{40}$")) {
|
if (null == sha1 || !sha1.matches("^[0-9A-Fa-f]{40}$")) {
|
||||||
@@ -142,7 +135,7 @@ public class NexusSearch {
|
|||||||
} catch (FileNotFoundException fnfe) {
|
} catch (FileNotFoundException fnfe) {
|
||||||
/* This is what we get when the SHA1 they sent doesn't exist in
|
/* This is what we get when the SHA1 they sent doesn't exist in
|
||||||
* Nexus. This is useful upstream for recovery, so we just re-throw it
|
* Nexus. This is useful upstream for recovery, so we just re-throw it
|
||||||
*/
|
*/
|
||||||
throw fnfe;
|
throw fnfe;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Anything else is jacked-up XML stuff that we really can't recover
|
// Anything else is jacked-up XML stuff that we really can't recover
|
||||||
@@ -154,8 +147,7 @@ public class NexusSearch {
|
|||||||
/**
|
/**
|
||||||
* Do a preflight request to see if the repository is actually working.
|
* Do a preflight request to see if the repository is actually working.
|
||||||
*
|
*
|
||||||
* @return whether the repository is listening and returns the /status URL
|
* @return whether the repository is listening and returns the /status URL correctly
|
||||||
* correctly
|
|
||||||
*/
|
*/
|
||||||
public boolean preflightRequest() {
|
public boolean preflightRequest() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user