Skip to content

Commit 2fb1dd1

Browse files
committed
Remove obsolete org.springframework.core.NestedIOException
This commit removes Spring's custom NestedIOException and replaces its usage with the standard IOException which has supported a root cause since Java 6. Closes gh-28198
1 parent b570f60 commit 2fb1dd1

File tree

6 files changed

+11
-96
lines changed

6 files changed

+11
-96
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import org.springframework.beans.factory.support.BeanNameGenerator;
5555
import org.springframework.context.annotation.ConfigurationCondition.ConfigurationPhase;
5656
import org.springframework.context.annotation.DeferredImportSelector.Group;
57-
import org.springframework.core.NestedIOException;
5857
import org.springframework.core.OrderComparator;
5958
import org.springframework.core.Ordered;
6059
import org.springframework.core.annotation.AnnotationAttributes;
@@ -690,7 +689,7 @@ SourceClass asSourceClass(@Nullable String className, Predicate<String> filter)
690689
return new SourceClass(ClassUtils.forName(className, this.resourceLoader.getClassLoader()));
691690
}
692691
catch (ClassNotFoundException ex) {
693-
throw new NestedIOException("Failed to load class [" + className + "]", ex);
692+
throw new IOException("Failed to load class [" + className + "]", ex);
694693
}
695694
}
696695
return new SourceClass(this.metadataReaderFactory.getMetadataReader(className));
@@ -1079,7 +1078,7 @@ private SourceClass getRelated(String className) throws IOException {
10791078
catch (ClassNotFoundException ex) {
10801079
// Ignore -> fall back to ASM next, except for core java types.
10811080
if (className.startsWith("java")) {
1082-
throw new NestedIOException("Failed to load class [" + className + "]", ex);
1081+
throw new IOException("Failed to load class [" + className + "]", ex);
10831082
}
10841083
return new SourceClass(metadataReaderFactory.getMetadataReader(className));
10851084
}

spring-core/src/main/java/org/springframework/core/NestedIOException.java

Lines changed: 0 additions & 80 deletions
This file was deleted.

spring-core/src/main/java/org/springframework/core/io/AbstractResource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,6 @@
3030
import org.apache.commons.logging.Log;
3131
import org.apache.commons.logging.LogFactory;
3232

33-
import org.springframework.core.NestedIOException;
3433
import org.springframework.lang.Nullable;
3534
import org.springframework.util.ResourceUtils;
3635

@@ -120,7 +119,7 @@ public URI getURI() throws IOException {
120119
return ResourceUtils.toURI(url);
121120
}
122121
catch (URISyntaxException ex) {
123-
throw new NestedIOException("Invalid URI [" + url + "]", ex);
122+
throw new IOException("Invalid URI [" + url + "]", ex);
124123
}
125124
}
126125

spring-core/src/main/java/org/springframework/core/io/VfsResource.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@
2222
import java.net.URI;
2323
import java.net.URL;
2424

25-
import org.springframework.core.NestedIOException;
2625
import org.springframework.lang.Nullable;
2726
import org.springframework.util.Assert;
2827

@@ -76,7 +75,7 @@ public URL getURL() throws IOException {
7675
return VfsUtils.getURL(this.resource);
7776
}
7877
catch (Exception ex) {
79-
throw new NestedIOException("Failed to obtain URL for file " + this.resource, ex);
78+
throw new IOException("Failed to obtain URL for file " + this.resource, ex);
8079
}
8180
}
8281

@@ -86,7 +85,7 @@ public URI getURI() throws IOException {
8685
return VfsUtils.getURI(this.resource);
8786
}
8887
catch (Exception ex) {
89-
throw new NestedIOException("Failed to obtain URI for " + this.resource, ex);
88+
throw new IOException("Failed to obtain URI for " + this.resource, ex);
9089
}
9190
}
9291

spring-core/src/main/java/org/springframework/core/serializer/DefaultDeserializer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
2121
import java.io.ObjectInputStream;
2222

2323
import org.springframework.core.ConfigurableObjectInputStream;
24-
import org.springframework.core.NestedIOException;
2524
import org.springframework.lang.Nullable;
2625

2726
/**
@@ -72,7 +71,7 @@ public Object deserialize(InputStream inputStream) throws IOException {
7271
return objectInputStream.readObject();
7372
}
7473
catch (ClassNotFoundException ex) {
75-
throw new NestedIOException("Failed to deserialize object type", ex);
74+
throw new IOException("Failed to deserialize object type", ex);
7675
}
7776
}
7877

spring-core/src/main/java/org/springframework/core/type/classreading/SimpleMetadataReader.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.io.InputStream;
2121

2222
import org.springframework.asm.ClassReader;
23-
import org.springframework.core.NestedIOException;
2423
import org.springframework.core.io.Resource;
2524
import org.springframework.core.type.AnnotationMetadata;
2625
import org.springframework.core.type.ClassMetadata;
@@ -57,7 +56,7 @@ private static ClassReader getClassReader(Resource resource) throws IOException
5756
return new ClassReader(is);
5857
}
5958
catch (IllegalArgumentException ex) {
60-
throw new NestedIOException("ASM ClassReader failed to parse class file - " +
59+
throw new IOException("ASM ClassReader failed to parse class file - " +
6160
"probably due to a new Java class file version that isn't supported yet: " + resource, ex);
6261
}
6362
}

0 commit comments

Comments
 (0)