Skip to content

Commit dbf8e67

Browse files
committed
refactor: #7510 make change non-breaking at public API level
1 parent 5158c50 commit dbf8e67

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

core/src/main/java/org/owasp/dependencycheck/analyzer/CentralAnalyzer.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,16 @@ public void analyzeDependency(Dependency dependency, Engine engine) throws Analy
310310
LOGGER.info("invalid sha1-hash on {}", dependency.getFileName());
311311
} catch (FileNotFoundException fnfe) {
312312
LOGGER.debug("Artifact not found in repository: '{}", dependency.getFileName());
313-
} catch (IOException ioe) {
314-
final String message = "Could not connect to Central search. Analysis failed.";
315-
LOGGER.error(message, ioe);
316-
throw new AnalysisException(message, ioe);
317313
} catch (ForbiddenException e) {
318314
final String message = "Connection to Central search refused. This is most likely not a problem with " +
319315
"Dependency-Check itself and is related to network connectivity. Please check " +
320316
"https://central.sonatype.org/faq/403-error-central/.";
321317
LOGGER.error(message);
322318
throw new AnalysisException(message, e);
319+
} catch (IOException ioe) {
320+
final String message = "Could not connect to Central search. Analysis failed.";
321+
LOGGER.error(message, ioe);
322+
throw new AnalysisException(message, ioe);
323323
}
324324
}
325325

@@ -338,7 +338,7 @@ public void analyzeDependency(Dependency dependency, Engine engine) throws Analy
338338
* requests.
339339
*/
340340
protected List<MavenArtifact> fetchMavenArtifacts(Dependency dependency) throws IOException,
341-
TooManyRequestsException, ForbiddenException {
341+
TooManyRequestsException {
342342
IOException lastException = null;
343343
long sleepingTimeBetweenRetriesInMillis = BASE_RETRY_WAIT;
344344
int triesLeft = numberOfRetries;

core/src/main/java/org/owasp/dependencycheck/data/nexus/NexusV2Search.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public boolean preflightRequest() {
164164
LOGGER.warn("Pre-flight request to Nexus failed; expected root node name of status, got {}", doc.getDocumentElement().getNodeName());
165165
return false;
166166
}
167-
} catch (IOException | TooManyRequestsException | ResourceNotFoundException | URISyntaxException | ForbiddenException e) {
167+
} catch (IOException | TooManyRequestsException | ResourceNotFoundException | URISyntaxException e) {
168168
LOGGER.warn("Pre-flight request to Nexus failed: ", e);
169169
return false;
170170
}

core/src/main/java/org/owasp/dependencycheck/data/update/KnownExploitedDataSource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.owasp.dependencycheck.data.update.exception.CorruptedDatastreamException;
3636
import org.owasp.dependencycheck.data.update.exception.UpdateException;
3737
import org.owasp.dependencycheck.utils.Downloader;
38-
import org.owasp.dependencycheck.utils.ForbiddenException;
3938
import org.owasp.dependencycheck.utils.ResourceNotFoundException;
4039
import org.owasp.dependencycheck.utils.Settings;
4140
import org.owasp.dependencycheck.utils.TooManyRequestsException;
@@ -103,7 +102,7 @@ public KnownExploitedVulnerabilitiesSchema handleEntity(HttpEntity entity) throw
103102
dbProperties.save(DatabaseProperties.KEV_LAST_CHECKED, Long.toString(System.currentTimeMillis() / 1000));
104103
return true;
105104
} catch (TooManyRequestsException | ResourceNotFoundException | IOException | DatabaseException
106-
| SQLException | URISyntaxException | ForbiddenException ex) {
105+
| SQLException | URISyntaxException ex) {
107106
throw new UpdateException(ex);
108107
}
109108
}

utils/src/main/java/org/owasp/dependencycheck/utils/ForbiddenException.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
*/
1919
package org.owasp.dependencycheck.utils;
2020

21-
public class ForbiddenException extends Exception {
21+
import java.io.IOException;
22+
23+
public class ForbiddenException extends IOException {
2224

2325
public ForbiddenException(String message) {
2426
super(message);

0 commit comments

Comments
 (0)