mirror of https://github.com/apache/jclouds.git
JCLOUDS-410. Correctly override getInput
Payload.getInput must always call openStream to handle overridden methods correctly. Previously this caused errors in jclouds-chef in BaseCipherPayload.
This commit is contained in:
parent
16ea4fb33f
commit
9d2e4759a3
|
@ -44,8 +44,8 @@ public abstract class BaseCipherPayload extends DelegatingPayload {
|
|||
public abstract Cipher initializeCipher(Key key);
|
||||
|
||||
@Override
|
||||
public CipherInputStream openStream() {
|
||||
return new CipherInputStream(super.getInput(), initializeCipher(key));
|
||||
public CipherInputStream openStream() throws IOException {
|
||||
return new CipherInputStream(super.openStream(), initializeCipher(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
import org.jclouds.io.MutableContentMetadata;
|
||||
import org.jclouds.io.Payload;
|
||||
|
||||
|
@ -50,7 +52,11 @@ public class DelegatingPayload implements Payload {
|
|||
*/
|
||||
@Override
|
||||
public InputStream getInput() {
|
||||
return delegate.getInput();
|
||||
try {
|
||||
return openStream();
|
||||
} catch (IOException ioe) {
|
||||
throw Throwables.propagate(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -74,8 +74,8 @@ public class MultipartFormTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInput() {
|
||||
return realPayload.getInput();
|
||||
public InputStream openStream() throws IOException {
|
||||
return realPayload.openStream();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue