Skip to content

Commit bf48163

Browse files
author
Vincent Potucek
committed
Pull #2287: Modernize codebase with Java improvements - Unnecessary throws
1 parent d65c375 commit bf48163

File tree

112 files changed

+267
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+267
-328
lines changed

compat/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void testToSnapshotVersion() {
6363
* Tests that the ordering of the map resembles the ordering of the input collection of artifacts.
6464
*/
6565
@Test
66-
void testArtifactMapByVersionlessIdOrdering() throws Exception {
66+
void testArtifactMapByVersionlessIdOrdering() {
6767
List<Artifact> list = new ArrayList<>();
6868
list.add(newArtifact("b"));
6969
list.add(newArtifact("a"));

compat/maven-artifact/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DefaultArtifactTest {
5555
private ArtifactHandlerMock artifactHandler;
5656

5757
@BeforeEach
58-
void setUp() throws Exception {
58+
void setUp() {
5959
artifactHandler = new ArtifactHandlerMock();
6060
versionRange = VersionRange.createFromVersion(version);
6161
artifact = new DefaultArtifact(groupId, artifactId, versionRange, scope, type, classifier, artifactHandler);

compat/maven-compat/src/main/java/org/apache/maven/DefaultProjectDependenciesResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private Set<Artifact> resolveImpl(
107107
Collection<String> scopesToResolve,
108108
MavenSession session,
109109
Set<String> projectIds)
110-
throws ArtifactResolutionException, ArtifactNotFoundException {
110+
throws ArtifactResolutionException {
111111
Set<Artifact> resolved = new LinkedHashSet<>();
112112

113113
if (projects == null || projects.isEmpty()) {

compat/maven-compat/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public ArtifactResolutionResult resolveTransitively(
349349
}
350350

351351
public ArtifactResolutionResult resolveWithExceptions(ArtifactResolutionRequest request)
352-
throws ArtifactResolutionException, ArtifactNotFoundException {
352+
throws ArtifactResolutionException {
353353
ArtifactResolutionResult result = resolve(request);
354354

355355
// We have collected all the problems so let's mimic the way the old code worked and just blow up right here.

compat/maven-compat/src/main/java/org/apache/maven/repository/metadata/ClasspathContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public List<ArtifactMetadata> getClasspath() {
6868
}
6969

7070
// -------------------------------------------------------------------------------------------
71-
public MetadataTreeNode getClasspathAsTree() throws MetadataResolutionException {
71+
public MetadataTreeNode getClasspathAsTree() {
7272
if (classpath == null || classpath.size() < 1) {
7373
return null;
7474
}

compat/maven-compat/src/main/java/org/apache/maven/settings/DefaultMavenSettingsBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public Settings buildSettings(File userSettingsFile, boolean useCachedSettings)
7575
return buildSettings(userSettingsFile);
7676
}
7777

78-
private Settings build(SettingsBuildingRequest request) throws IOException, XmlPullParserException {
78+
private Settings build(SettingsBuildingRequest request) throws IOException {
7979
try {
8080
return settingsBuilder.build(request).getEffectiveSettings();
8181
} catch (SettingsBuildingException e) {

compat/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected String getRepositoryLayout() {
142142
return "default";
143143
}
144144

145-
protected ArtifactRepository localRepository() throws Exception {
145+
protected ArtifactRepository localRepository() {
146146
String path = "target/test-repositories/" + component() + "/local-repository";
147147

148148
File f = new File(getBasedir(), path);
@@ -151,7 +151,7 @@ protected ArtifactRepository localRepository() throws Exception {
151151
"local", "file://" + f.getPath(), repoLayout, null, null);
152152
}
153153

154-
protected ArtifactRepository remoteRepository() throws Exception {
154+
protected ArtifactRepository remoteRepository() {
155155
String path = "target/test-repositories/" + component() + "/remote-repository";
156156

157157
File f = new File(getBasedir(), path);
@@ -164,7 +164,7 @@ protected ArtifactRepository remoteRepository() throws Exception {
164164
new ArtifactRepositoryPolicy());
165165
}
166166

167-
protected ArtifactRepository badRemoteRepository() throws Exception {
167+
protected ArtifactRepository badRemoteRepository() {
168168
return artifactRepositoryFactory.createArtifactRepository(
169169
"test", "http://foo.bar/repository", repoLayout, null, null);
170170
}
@@ -281,7 +281,7 @@ protected Artifact createArtifact(String artifactId, String version, String type
281281
return createArtifact("org.apache.maven", artifactId, version, type);
282282
}
283283

284-
protected Artifact createArtifact(String groupId, String artifactId, String version, String type) throws Exception {
284+
protected Artifact createArtifact(String groupId, String artifactId, String version, String type) {
285285
Artifact a = artifactFactory.createBuildArtifact(groupId, artifactId, version, type);
286286

287287
return a;

compat/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void testResolutionOfASingleArtifactWhereTheArtifactIsNotPresentLocallyAndMustBe
9797
}
9898

9999
@Override
100-
protected Artifact createArtifact(String groupId, String artifactId, String version, String type) throws Exception {
100+
protected Artifact createArtifact(String groupId, String artifactId, String version, String type) {
101101
// for the anonymous classes
102102
return super.createArtifact(groupId, artifactId, version, type);
103103
}

compat/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.apache.maven.project.artifact.DefaultMetadataSource;
5757
import org.apache.maven.repository.legacy.LegacyRepositorySystem;
5858
import org.codehaus.plexus.PlexusContainer;
59-
import org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException;
6059
import org.codehaus.plexus.testing.PlexusTest;
6160
import org.eclipse.aether.DefaultRepositorySystemSession;
6261
import org.eclipse.aether.internal.impl.DefaultChecksumPolicyProvider;
@@ -253,7 +252,7 @@ void testLocalRepositoryBasedir() throws Exception {
253252
SwitchableMetadataSource switchableMetadataSource;
254253

255254
@BeforeEach
256-
void setup() throws CycleDetectedInComponentGraphException {
255+
void setup() {
257256
switchableMetadataSource.setDelegate(defaultMetadataSource);
258257
}
259258
}

compat/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void transferInitiated(TransferEvent transferEvent) {
105105
}
106106

107107
@Test
108-
void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolException, IOException {
108+
void testGetMissingJar() throws TransferFailedException, IOException {
109109
Artifact artifact = createTestArtifact("target/test-data/get-missing-jar", "jar");
110110

111111
ArtifactRepository repo = createStringRepo();
@@ -116,7 +116,7 @@ void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolExce
116116
}
117117

118118
@Test
119-
void testGetMissingJarForced() throws TransferFailedException, UnsupportedProtocolException, IOException {
119+
void testGetMissingJarForced() throws TransferFailedException, IOException {
120120
Artifact artifact = createTestArtifact("target/test-data/get-missing-jar", "jar");
121121

122122
ArtifactRepository repo = createStringRepo();

0 commit comments

Comments
 (0)