removed my previous "correction" for the if statement...

Former-commit-id: 1ff71f2853dd981a9d4d5c48906853425a9fc2b6
This commit is contained in:
Jeremy Long
2014-02-28 06:03:26 -05:00
parent dfb78788f9
commit 337e9ac3ef

View File

@@ -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}$")) {
@@ -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 {