INT-3746: Polishing
- move `InputStream` test later - add `name` for error messages - add test
This commit is contained in:
@@ -490,10 +490,7 @@ public class RemoteFileTemplate<F> implements RemoteFileOperations<F>, Initializ
|
||||
Object payload = message.getPayload();
|
||||
InputStream dataInputStream = null;
|
||||
String name = null;
|
||||
if (payload instanceof InputStream) {
|
||||
dataInputStream = (InputStream) payload;
|
||||
}
|
||||
else if (payload instanceof File) {
|
||||
if (payload instanceof File) {
|
||||
File inputFile = (File) payload;
|
||||
if (inputFile.exists()) {
|
||||
dataInputStream = new BufferedInputStream(new FileInputStream(inputFile));
|
||||
@@ -512,9 +509,13 @@ public class RemoteFileTemplate<F> implements RemoteFileOperations<F>, Initializ
|
||||
}
|
||||
dataInputStream = new ByteArrayInputStream(bytes);
|
||||
}
|
||||
else if (payload instanceof InputStream) {
|
||||
dataInputStream = (InputStream) payload;
|
||||
name = "InputStream payload";
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Unsupported payload type. The only supported payloads are " +
|
||||
"java.io.File, java.lang.String, byte[] and InputStream");
|
||||
"java.io.File, java.lang.String, byte[], and InputStream");
|
||||
}
|
||||
if (dataInputStream == null) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user