diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java b/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java
index 20b44df103..33f7658b37 100644
--- a/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java
+++ b/org.springframework.core/src/main/java/org/springframework/core/io/AbstractResource.java
@@ -25,7 +25,6 @@ import java.net.URISyntaxException;
import java.net.URL;
import org.springframework.core.NestedIOException;
-import org.springframework.util.Assert;
import org.springframework.util.ResourceUtils;
/**
@@ -113,16 +112,14 @@ public abstract class AbstractResource implements Resource {
* content length. Subclasses will almost always be able to provide
* a more optimal version of this, e.g. checking a File length.
* @see #getInputStream()
- * @throws IllegalStateException if {@link #getInputStream()} returns null.
*/
public long contentLength() throws IOException {
- InputStream is = this.getInputStream();
- Assert.state(is != null, "resource input stream must not be null");
+ InputStream is = getInputStream();
try {
long size = 0;
byte[] buf = new byte[255];
int read;
- while((read = is.read(buf)) != -1) {
+ while ((read = is.read(buf)) != -1) {
size += read;
}
return size;
diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamSource.java b/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamSource.java
index 33bac47915..7e1f58a0c7 100644
--- a/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamSource.java
+++ b/org.springframework.core/src/main/java/org/springframework/core/io/InputStreamSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ public interface InputStreamSource {
* as JavaMail, which needs to be able to read the stream multiple times when
* creating mail attachments. For such a use case, it is required
* that each getInputStream() call returns a fresh stream.
+ * @return the input stream for the underlying resource (must not be {@code null})
* @throws IOException if the stream could not be opened
* @see org.springframework.mail.javamail.MimeMessageHelper#addAttachment(String, InputStreamSource)
*/
diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/Resource.java b/org.springframework.core/src/main/java/org/springframework/core/io/Resource.java
index 0d088b9202..b242ffc2c4 100644
--- a/org.springframework.core/src/main/java/org/springframework/core/io/Resource.java
+++ b/org.springframework.core/src/main/java/org/springframework/core/io/Resource.java
@@ -133,9 +133,4 @@ public interface Resource extends InputStreamSource {
*/
String getDescription();
- /**
- * {@inheritDoc}
- * @return the input stream for the underlying resource (must not be {@code null}).
- */
- public InputStream getInputStream() throws IOException;
}